sf: Change interface definition methodology (#1074)
* sf: Begin experimenting with new interface declaration format * sf: convert fs interfaces to new format * sf: finish conversion of libstrat to new definitions * sf: convert loader to new format * sf: convert spl to new format * sf: update ncm for new format * sf: convert pm to new format * sf: convert ro/sm to new format * sf: update fatal for new format * sf: support building dmnt under new scheme * sf: update ams.mitm for new format * sf: correct invocation def for pointer holder * fs: correct 10.x+ user bindings for Get*SpaceSize
This commit is contained in:
@@ -27,7 +27,7 @@ namespace ams::ncm {
|
||||
void Initialize() {
|
||||
AMS_ASSERT(g_content_manager == nullptr);
|
||||
R_ABORT_UNLESS(ncmInitialize());
|
||||
g_content_manager = std::make_shared<RemoteContentManagerImpl>();
|
||||
g_content_manager = sf::MakeShared<IContentManager, RemoteContentManagerImpl>();
|
||||
}
|
||||
|
||||
void Finalize() {
|
||||
|
||||
@@ -553,23 +553,23 @@ namespace ams::ncm {
|
||||
|
||||
if (storage_id == StorageId::GameCard) {
|
||||
/* Game card content storage is read only. */
|
||||
auto content_storage = std::make_shared<ReadOnlyContentStorageImpl>();
|
||||
R_TRY(content_storage->Initialize(root->path, MakeFlatContentFilePath));
|
||||
auto content_storage = sf::MakeShared<IContentStorage, ReadOnlyContentStorageImpl>();
|
||||
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeFlatContentFilePath));
|
||||
root->content_storage = std::move(content_storage);
|
||||
} else {
|
||||
/* Create a content storage. */
|
||||
auto content_storage = std::make_shared<ContentStorageImpl>();
|
||||
auto content_storage = sf::MakeShared<IContentStorage, ContentStorageImpl>();
|
||||
|
||||
/* Initialize content storage with an appropriate path function. */
|
||||
switch (storage_id) {
|
||||
case StorageId::BuiltInSystem:
|
||||
R_TRY(content_storage->Initialize(root->path, MakeFlatContentFilePath, MakeFlatPlaceHolderFilePath, false, std::addressof(this->rights_id_cache)));
|
||||
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeFlatContentFilePath, MakeFlatPlaceHolderFilePath, false, std::addressof(this->rights_id_cache)));
|
||||
break;
|
||||
case StorageId::SdCard:
|
||||
R_TRY(content_storage->Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, true, std::addressof(this->rights_id_cache)));
|
||||
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, true, std::addressof(this->rights_id_cache)));
|
||||
break;
|
||||
default:
|
||||
R_TRY(content_storage->Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, false, std::addressof(this->rights_id_cache)));
|
||||
R_TRY(content_storage->GetImpl().Initialize(root->path, MakeSha256HierarchicalContentFilePath_ForFat16KCluster, MakeSha256HierarchicalPlaceHolderFilePath_ForFat16KCluster, false, std::addressof(this->rights_id_cache)));
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -617,7 +617,7 @@ namespace ams::ncm {
|
||||
R_TRY(root->kvs->Initialize(root->max_content_metas, root->memory_resource));
|
||||
|
||||
/* Create an on memory content meta database for game cards. */
|
||||
root->content_meta_database = std::make_shared<OnMemoryContentMetaDatabaseImpl>(std::addressof(*root->kvs));
|
||||
root->content_meta_database = sf::MakeShared<IContentMetaDatabase, OnMemoryContentMetaDatabaseImpl>(std::addressof(*root->kvs));
|
||||
} else {
|
||||
/* Mount save data for this root. */
|
||||
R_TRY(fs::MountSystemSaveData(root->mount_name, root->info.space_id, root->info.id));
|
||||
@@ -630,7 +630,7 @@ namespace ams::ncm {
|
||||
R_TRY(root->kvs->Load());
|
||||
|
||||
/* Create the content meta database. */
|
||||
root->content_meta_database = std::make_shared<ContentMetaDatabaseImpl>(std::addressof(*root->kvs), root->mount_name);
|
||||
root->content_meta_database = sf::MakeShared<IContentMetaDatabase, ContentMetaDatabaseImpl>(std::addressof(*root->kvs), root->mount_name);
|
||||
mount_guard.Cancel();
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
class ContentMetaDatabaseImplBase : public IContentMetaDatabase {
|
||||
class ContentMetaDatabaseImplBase {
|
||||
NON_COPYABLE(ContentMetaDatabaseImplBase);
|
||||
NON_MOVEABLE(ContentMetaDatabaseImplBase);
|
||||
protected:
|
||||
@@ -52,6 +52,32 @@ namespace ams::ncm {
|
||||
R_TRY(this->GetContentMetaSize(out_size, key));
|
||||
return this->kvs->GetValuePointer(reinterpret_cast<const ContentMetaHeader **>(out_value_ptr), key);
|
||||
}
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) = 0;
|
||||
virtual Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) = 0;
|
||||
virtual Result Remove(const ContentMetaKey &key) = 0;
|
||||
virtual Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) = 0;
|
||||
virtual Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) = 0;
|
||||
virtual Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) = 0;
|
||||
virtual Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) = 0;
|
||||
virtual Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) = 0;
|
||||
virtual Result Has(sf::Out<bool> out, const ContentMetaKey &key) = 0;
|
||||
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 DisableForcibly() = 0;
|
||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) = 0;
|
||||
virtual Result Commit() = 0;
|
||||
virtual Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) = 0;
|
||||
virtual Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) = 0;
|
||||
virtual Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) = 0;
|
||||
virtual Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) = 0;
|
||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) = 0;
|
||||
virtual Result GetCount(sf::Out<u32> out_count) = 0;
|
||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) = 0;
|
||||
};
|
||||
static_assert(ncm::IsIContentMetaDatabase<ContentMetaDatabaseImplBase>);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
class ContentStorageImplBase : public IContentStorage {
|
||||
class ContentStorageImplBase {
|
||||
NON_COPYABLE(ContentStorageImplBase);
|
||||
NON_MOVEABLE(ContentStorageImplBase);
|
||||
protected:
|
||||
@@ -43,6 +43,39 @@ namespace ams::ncm {
|
||||
}
|
||||
return ResultSuccess();
|
||||
}
|
||||
public:
|
||||
/* Actual commands. */
|
||||
virtual Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) = 0;
|
||||
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) = 0;
|
||||
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) = 0;
|
||||
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) = 0;
|
||||
virtual Result Delete(ContentId content_id) = 0;
|
||||
virtual Result Has(sf::Out<bool> out, ContentId content_id) = 0;
|
||||
virtual Result GetPath(sf::Out<Path> out, ContentId content_id) = 0;
|
||||
virtual Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) = 0;
|
||||
virtual Result CleanupAllPlaceHolder() = 0;
|
||||
virtual Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) = 0;
|
||||
virtual Result GetContentCount(sf::Out<s32> out_count) = 0;
|
||||
virtual Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 start_offset) = 0;
|
||||
virtual Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) = 0;
|
||||
virtual Result DisableForcibly() = 0;
|
||||
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) = 0;
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) = 0;
|
||||
virtual Result ReadContentIdFile(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 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 WriteContentForDebug(ContentId content_id, s64 offset, 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;
|
||||
};
|
||||
static_assert(ncm::IsIContentStorage<ContentStorageImplBase>);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,80 +20,81 @@
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
class RemoteContentManagerImpl final : public IContentManager {
|
||||
class RemoteContentManagerImpl final {
|
||||
public:
|
||||
RemoteContentManagerImpl() { /* ... */ }
|
||||
|
||||
~RemoteContentManagerImpl() { /* ... */ }
|
||||
public:
|
||||
virtual Result CreateContentStorage(StorageId storage_id) override {
|
||||
Result CreateContentStorage(StorageId storage_id) {
|
||||
return ::ncmCreateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result CreateContentMetaDatabase(StorageId storage_id) override {
|
||||
Result CreateContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmCreateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result VerifyContentStorage(StorageId storage_id) override {
|
||||
Result VerifyContentStorage(StorageId storage_id) {
|
||||
return ::ncmVerifyContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result VerifyContentMetaDatabase(StorageId storage_id) override {
|
||||
Result VerifyContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmVerifyContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) override {
|
||||
Result OpenContentStorage(sf::Out<std::shared_ptr<IContentStorage>> out, StorageId storage_id) {
|
||||
NcmContentStorage cs;
|
||||
R_TRY(::ncmOpenContentStorage(std::addressof(cs), static_cast<NcmStorageId>(storage_id)));
|
||||
|
||||
out.SetValue(std::make_shared<RemoteContentStorageImpl>(cs));
|
||||
out.SetValue(sf::MakeShared<IContentStorage, RemoteContentStorageImpl>(cs));
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) override {
|
||||
Result OpenContentMetaDatabase(sf::Out<std::shared_ptr<IContentMetaDatabase>> out, StorageId storage_id) {
|
||||
NcmContentMetaDatabase db;
|
||||
R_TRY(::ncmOpenContentMetaDatabase(std::addressof(db), static_cast<NcmStorageId>(storage_id)));
|
||||
|
||||
out.SetValue(std::make_shared<RemoteContentMetaDatabaseImpl>(db));
|
||||
out.SetValue(sf::MakeShared<IContentMetaDatabase, RemoteContentMetaDatabaseImpl>(db));
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result CloseContentStorageForcibly(StorageId storage_id) override {
|
||||
Result CloseContentStorageForcibly(StorageId storage_id) {
|
||||
return ::ncmCloseContentStorageForcibly(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result CloseContentMetaDatabaseForcibly(StorageId storage_id) override {
|
||||
Result CloseContentMetaDatabaseForcibly(StorageId storage_id) {
|
||||
return ::ncmCloseContentMetaDatabaseForcibly(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result CleanupContentMetaDatabase(StorageId storage_id) override {
|
||||
Result CleanupContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmCleanupContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result ActivateContentStorage(StorageId storage_id) override {
|
||||
Result ActivateContentStorage(StorageId storage_id) {
|
||||
return ::ncmActivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result InactivateContentStorage(StorageId storage_id) override {
|
||||
Result InactivateContentStorage(StorageId storage_id) {
|
||||
return ::ncmInactivateContentStorage(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result ActivateContentMetaDatabase(StorageId storage_id) override {
|
||||
Result ActivateContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmActivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result InactivateContentMetaDatabase(StorageId storage_id) override {
|
||||
Result InactivateContentMetaDatabase(StorageId storage_id) {
|
||||
return ::ncmInactivateContentMetaDatabase(static_cast<NcmStorageId>(storage_id));
|
||||
}
|
||||
|
||||
virtual Result InvalidateRightsIdCache() override {
|
||||
Result InvalidateRightsIdCache() {
|
||||
return ::ncmInvalidateRightsIdCache();
|
||||
}
|
||||
|
||||
virtual Result GetMemoryReport(sf::Out<MemoryReport> out) override {
|
||||
Result GetMemoryReport(sf::Out<MemoryReport> out) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
};
|
||||
static_assert(ncm::IsIContentManager<RemoteContentManagerImpl>);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
class RemoteContentMetaDatabaseImpl final : public IContentMetaDatabase {
|
||||
class RemoteContentMetaDatabaseImpl final {
|
||||
private:
|
||||
::NcmContentMetaDatabase srv;
|
||||
public:
|
||||
@@ -71,101 +71,101 @@ namespace ams::ncm {
|
||||
return reinterpret_cast<const ::NcmContentId *>(std::addressof(c));
|
||||
}
|
||||
public:
|
||||
virtual Result Set(const ContentMetaKey &key, sf::InBuffer value) override {
|
||||
Result Set(const ContentMetaKey &key, sf::InBuffer value) {
|
||||
return ncmContentMetaDatabaseSet(std::addressof(this->srv), Convert(key), value.GetPointer(), value.GetSize());
|
||||
}
|
||||
|
||||
virtual Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) override {
|
||||
Result Get(sf::Out<u64> out_size, const ContentMetaKey &key, sf::OutBuffer out_value) {
|
||||
return ncmContentMetaDatabaseGet(std::addressof(this->srv), Convert(key), out_size.GetPointer(), out_value.GetPointer(), out_value.GetSize());
|
||||
}
|
||||
|
||||
virtual Result Remove(const ContentMetaKey &key) override {
|
||||
Result Remove(const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseRemove(std::addressof(this->srv), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) override {
|
||||
Result GetContentIdByType(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type) {
|
||||
return ncmContentMetaDatabaseGetContentIdByType(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type));
|
||||
}
|
||||
|
||||
virtual Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) override {
|
||||
Result ListContentInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentInfo> &out_info, const ContentMetaKey &key, s32 offset) {
|
||||
return ncmContentMetaDatabaseListContentInfo(std::addressof(this->srv), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), Convert(key), offset);
|
||||
}
|
||||
|
||||
virtual Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) override {
|
||||
Result List(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaKey> &out_info, ContentMetaType meta_type, ApplicationId application_id, u64 min, u64 max, ContentInstallType install_type) {
|
||||
return ncmContentMetaDatabaseList(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_info.GetPointer()), out_info.GetSize(), static_cast<::NcmContentMetaType>(meta_type), application_id.value, min, max, static_cast<::NcmContentInstallType>(install_type));
|
||||
}
|
||||
|
||||
virtual Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) override {
|
||||
Result GetLatestContentMetaKey(sf::Out<ContentMetaKey> out_key, u64 id) {
|
||||
return ncmContentMetaDatabaseGetLatestContentMetaKey(std::addressof(this->srv), Convert(out_key.GetPointer()), static_cast<u64>(id));
|
||||
}
|
||||
|
||||
virtual Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) override {
|
||||
Result ListApplication(sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ApplicationContentMetaKey> &out_keys, ContentMetaType meta_type) {
|
||||
return ncmContentMetaDatabaseListApplication(std::addressof(this->srv), out_entries_total.GetPointer(), out_entries_written.GetPointer(), Convert(out_keys.GetPointer()), out_keys.GetSize(), static_cast<::NcmContentMetaType>(meta_type));
|
||||
}
|
||||
|
||||
virtual Result Has(sf::Out<bool> out, const ContentMetaKey &key) override {
|
||||
Result Has(sf::Out<bool> out, const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseHas(std::addressof(this->srv), out.GetPointer(), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) override {
|
||||
Result HasAll(sf::Out<bool> out, const sf::InArray<ContentMetaKey> &keys) {
|
||||
return ncmContentMetaDatabaseHasAll(std::addressof(this->srv), out.GetPointer(), Convert(keys.GetPointer()), keys.GetSize());
|
||||
}
|
||||
|
||||
virtual Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) override {
|
||||
Result GetSize(sf::Out<u64> out_size, const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseGetSize(std::addressof(this->srv), out_size.GetPointer(), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) override {
|
||||
Result GetRequiredSystemVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseGetRequiredSystemVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) override {
|
||||
Result GetPatchId(sf::Out<PatchId> out_patch_id, const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseGetPatchId(std::addressof(this->srv), reinterpret_cast<u64 *>(out_patch_id.GetPointer()), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result DisableForcibly() override {
|
||||
Result DisableForcibly() {
|
||||
return ncmContentMetaDatabaseDisableForcibly(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) override {
|
||||
Result LookupOrphanContent(const sf::OutArray<bool> &out_orphaned, const sf::InArray<ContentId> &content_ids) {
|
||||
return ncmContentMetaDatabaseLookupOrphanContent(std::addressof(this->srv), out_orphaned.GetPointer(), Convert(content_ids.GetPointer()), std::min(out_orphaned.GetSize(), content_ids.GetSize()));
|
||||
}
|
||||
|
||||
virtual Result Commit() override {
|
||||
Result Commit() {
|
||||
return ncmContentMetaDatabaseCommit(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) override {
|
||||
Result HasContent(sf::Out<bool> out, const ContentMetaKey &key, const ContentId &content_id) {
|
||||
return ncmContentMetaDatabaseHasContent(std::addressof(this->srv), out.GetPointer(), Convert(key), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) override {
|
||||
Result ListContentMetaInfo(sf::Out<s32> out_entries_written, const sf::OutArray<ContentMetaInfo> &out_meta_info, const ContentMetaKey &key, s32 offset) {
|
||||
return ncmContentMetaDatabaseListContentMetaInfo(std::addressof(this->srv), out_entries_written.GetPointer(), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), offset);
|
||||
}
|
||||
|
||||
virtual Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) override {
|
||||
Result GetAttributes(sf::Out<u8> out_attributes, const ContentMetaKey &key) {
|
||||
static_assert(sizeof(ContentMetaAttribute) == sizeof(u8));
|
||||
return ncmContentMetaDatabaseGetAttributes(std::addressof(this->srv), Convert(key), out_attributes.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) override {
|
||||
Result GetRequiredApplicationVersion(sf::Out<u32> out_version, const ContentMetaKey &key) {
|
||||
return ncmContentMetaDatabaseGetRequiredApplicationVersion(std::addressof(this->srv), out_version.GetPointer(), Convert(key));
|
||||
}
|
||||
|
||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override {
|
||||
Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||
return ncmContentMetaDatabaseGetContentIdByTypeAndIdOffset(std::addressof(this->srv), Convert(out_content_id.GetPointer()), Convert(key), static_cast<::NcmContentType>(type), id_offset);
|
||||
}
|
||||
|
||||
virtual Result GetCount(sf::Out<u32> out_count) override {
|
||||
Result GetCount(sf::Out<u32> out_count) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) override {
|
||||
Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) {
|
||||
/* TODO: libnx bindings */
|
||||
AMS_ABORT();
|
||||
}
|
||||
|
||||
};
|
||||
static_assert(ncm::IsIContentMetaDatabase<RemoteContentMetaDatabaseImpl>);
|
||||
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
|
||||
namespace ams::ncm {
|
||||
|
||||
class RemoteContentStorageImpl final : public IContentStorage {
|
||||
class RemoteContentStorageImpl final {
|
||||
private:
|
||||
::NcmContentStorage srv;
|
||||
public:
|
||||
@@ -46,85 +46,85 @@ namespace ams::ncm {
|
||||
return reinterpret_cast<::NcmContentId *>(std::addressof(c));
|
||||
}
|
||||
public:
|
||||
virtual Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) override {
|
||||
Result GeneratePlaceHolderId(sf::Out<PlaceHolderId> out) {
|
||||
return ncmContentStorageGeneratePlaceHolderId(std::addressof(this->srv), Convert(out.GetPointer()));
|
||||
}
|
||||
|
||||
virtual Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) override {
|
||||
Result CreatePlaceHolder(PlaceHolderId placeholder_id, ContentId content_id, s64 size) {
|
||||
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
|
||||
return ncmContentStorageCreatePlaceHolder(std::addressof(this->srv), Convert(content_id), Convert(placeholder_id), size);
|
||||
}
|
||||
|
||||
virtual Result DeletePlaceHolder(PlaceHolderId placeholder_id) override {
|
||||
Result DeletePlaceHolder(PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageDeletePlaceHolder(std::addressof(this->srv), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) override {
|
||||
Result HasPlaceHolder(sf::Out<bool> out, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageHasPlaceHolder(std::addressof(this->srv), out.GetPointer(), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) override {
|
||||
Result WritePlaceHolder(PlaceHolderId placeholder_id, s64 offset, sf::InBuffer data) {
|
||||
return ncmContentStorageWritePlaceHolder(std::addressof(this->srv), Convert(placeholder_id), offset, data.GetPointer(), data.GetSize());
|
||||
}
|
||||
|
||||
virtual Result Register(PlaceHolderId placeholder_id, ContentId content_id) override {
|
||||
Result Register(PlaceHolderId placeholder_id, ContentId content_id) {
|
||||
static_assert(alignof(ContentId) < alignof(PlaceHolderId));
|
||||
return ncmContentStorageRegister(std::addressof(this->srv), Convert(content_id), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result Delete(ContentId content_id) override {
|
||||
Result Delete(ContentId content_id) {
|
||||
return ncmContentStorageDelete(std::addressof(this->srv), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result Has(sf::Out<bool> out, ContentId content_id) override {
|
||||
Result Has(sf::Out<bool> out, ContentId content_id) {
|
||||
return ncmContentStorageHas(std::addressof(this->srv), out.GetPointer(), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result GetPath(sf::Out<Path> out, ContentId content_id) override {
|
||||
Result GetPath(sf::Out<Path> out, ContentId content_id) {
|
||||
return ncmContentStorageGetPath(std::addressof(this->srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) override {
|
||||
Result GetPlaceHolderPath(sf::Out<Path> out, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageGetPlaceHolderPath(std::addressof(this->srv), out.GetPointer()->str, sizeof(out.GetPointer()->str), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result CleanupAllPlaceHolder() override {
|
||||
Result CleanupAllPlaceHolder() {
|
||||
return ncmContentStorageCleanupAllPlaceHolder(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) override {
|
||||
Result ListPlaceHolder(sf::Out<s32> out_count, const sf::OutArray<PlaceHolderId> &out_buf) {
|
||||
return ncmContentStorageListPlaceHolder(std::addressof(this->srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result GetContentCount(sf::Out<s32> out_count) override {
|
||||
Result GetContentCount(sf::Out<s32> out_count) {
|
||||
return ncmContentStorageGetContentCount(std::addressof(this->srv), out_count.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) override {
|
||||
Result ListContentId(sf::Out<s32> out_count, const sf::OutArray<ContentId> &out_buf, s32 offset) {
|
||||
return ncmContentStorageListContentId(std::addressof(this->srv), Convert(out_buf.GetPointer()), out_buf.GetSize(), out_count.GetPointer(), offset);
|
||||
}
|
||||
|
||||
virtual Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) override {
|
||||
Result GetSizeFromContentId(sf::Out<s64> out_size, ContentId content_id) {
|
||||
return ncmContentStorageGetSizeFromContentId(std::addressof(this->srv), out_size.GetPointer(), Convert(content_id));
|
||||
}
|
||||
|
||||
virtual Result DisableForcibly() override {
|
||||
Result DisableForcibly() {
|
||||
return ncmContentStorageDisableForcibly(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) override {
|
||||
Result RevertToPlaceHolder(PlaceHolderId placeholder_id, ContentId old_content_id, ContentId new_content_id) {
|
||||
return ncmContentStorageRevertToPlaceHolder(std::addressof(this->srv), Convert(placeholder_id), Convert(old_content_id), Convert(new_content_id));
|
||||
}
|
||||
|
||||
virtual Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) override {
|
||||
Result SetPlaceHolderSize(PlaceHolderId placeholder_id, s64 size) {
|
||||
return ncmContentStorageSetPlaceHolderSize(std::addressof(this->srv), Convert(placeholder_id), size);
|
||||
}
|
||||
|
||||
virtual Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) override {
|
||||
Result ReadContentIdFile(sf::OutBuffer buf, ContentId content_id, s64 offset) {
|
||||
return ncmContentStorageReadContentIdFile(std::addressof(this->srv), buf.GetPointer(), buf.GetSize(), Convert(content_id), offset);
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) override {
|
||||
Result GetRightsIdFromPlaceHolderIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(this->srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace ams::ncm {
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) override {
|
||||
Result GetRightsIdFromPlaceHolderId(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromPlaceHolderId(std::addressof(this->srv), std::addressof(rights_id), Convert(placeholder_id)));
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace ams::ncm {
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) override {
|
||||
Result GetRightsIdFromContentIdDeprecated(sf::Out<ams::fs::RightsId> out_rights_id, ContentId content_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(this->srv), std::addressof(rights_id), Convert(content_id)));
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace ams::ncm {
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) override {
|
||||
Result GetRightsIdFromContentId(sf::Out<ncm::RightsId> out_rights_id, ContentId content_id) {
|
||||
::NcmRightsId rights_id;
|
||||
R_TRY(ncmContentStorageGetRightsIdFromContentId(std::addressof(this->srv), std::addressof(rights_id), Convert(content_id)));
|
||||
|
||||
@@ -160,35 +160,36 @@ namespace ams::ncm {
|
||||
return ResultSuccess();
|
||||
}
|
||||
|
||||
virtual Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) override {
|
||||
Result WriteContentForDebug(ContentId content_id, s64 offset, sf::InBuffer data) {
|
||||
return ncmContentStorageWriteContentForDebug(std::addressof(this->srv), Convert(content_id), offset, data.GetPointer(), data.GetSize());
|
||||
}
|
||||
|
||||
virtual Result GetFreeSpaceSize(sf::Out<s64> out_size) override {
|
||||
Result GetFreeSpaceSize(sf::Out<s64> out_size) {
|
||||
return ncmContentStorageGetFreeSpaceSize(std::addressof(this->srv), out_size.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result GetTotalSpaceSize(sf::Out<s64> out_size) override {
|
||||
Result GetTotalSpaceSize(sf::Out<s64> out_size) {
|
||||
return ncmContentStorageGetTotalSpaceSize(std::addressof(this->srv), out_size.GetPointer());
|
||||
}
|
||||
|
||||
virtual Result FlushPlaceHolder() override {
|
||||
Result FlushPlaceHolder() {
|
||||
return ncmContentStorageFlushPlaceHolder(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result GetSizeFromPlaceHolderId(sf::Out<s64> out_size, PlaceHolderId placeholder_id) override {
|
||||
Result GetSizeFromPlaceHolderId(sf::Out<s64> out_size, PlaceHolderId placeholder_id) {
|
||||
return ncmContentStorageGetSizeFromPlaceHolderId(std::addressof(this->srv), out_size.GetPointer(), Convert(placeholder_id));
|
||||
}
|
||||
|
||||
virtual Result RepairInvalidFileAttribute() override {
|
||||
Result RepairInvalidFileAttribute() {
|
||||
return ncmContentStorageRepairInvalidFileAttribute(std::addressof(this->srv));
|
||||
}
|
||||
|
||||
virtual Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) override {
|
||||
Result GetRightsIdFromPlaceHolderIdWithCache(sf::Out<ncm::RightsId> out_rights_id, PlaceHolderId placeholder_id, ContentId cache_content_id) {
|
||||
static_assert(sizeof(::NcmRightsId) == sizeof(ncm::RightsId));
|
||||
::NcmRightsId *out = reinterpret_cast<::NcmRightsId *>(out_rights_id.GetPointer());
|
||||
return ncmContentStorageGetRightsIdFromPlaceHolderIdWithCache(std::addressof(this->srv), out, Convert(placeholder_id), Convert(cache_content_id));
|
||||
}
|
||||
};
|
||||
static_assert(ncm::IsIContentStorage<RemoteContentStorageImpl>);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user