mirror of
https://github.com/Atmosphere-NX/Atmosphere
synced 2024-12-22 20:31:14 +00:00
ncm: GetContentAccessibilities, GetContentInfo*
This commit is contained in:
parent
9929517a83
commit
05de5538d6
15 changed files with 231 additions and 51 deletions
|
@ -0,0 +1,27 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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 <stratosphere/fs/fs_common.hpp>
|
||||||
|
#include <stratosphere/ncm/ncm_ids.hpp>
|
||||||
|
|
||||||
|
namespace ams::fs {
|
||||||
|
|
||||||
|
/* ACCURATE_TO_VERSION: Unknown */
|
||||||
|
enum ContentAttributes : u8 {
|
||||||
|
ContentAttributes_None = 0,
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
|
@ -21,6 +21,7 @@
|
||||||
#include <stratosphere/ncm/ncm_program_location.hpp>
|
#include <stratosphere/ncm/ncm_program_location.hpp>
|
||||||
#include <stratosphere/ncm/ncm_auto_buffer.hpp>
|
#include <stratosphere/ncm/ncm_auto_buffer.hpp>
|
||||||
#include <stratosphere/ncm/ncm_make_path.hpp>
|
#include <stratosphere/ncm/ncm_make_path.hpp>
|
||||||
|
#include <stratosphere/ncm/ncm_content_attributes.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_id_utils.hpp>
|
#include <stratosphere/ncm/ncm_content_id_utils.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_info_utils.hpp>
|
#include <stratosphere/ncm/ncm_content_info_utils.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_meta.hpp>
|
#include <stratosphere/ncm/ncm_content_meta.hpp>
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 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>
|
||||||
|
#include <stratosphere/fs/fs_content_attributes.hpp>
|
||||||
|
|
||||||
|
namespace ams::ncm {
|
||||||
|
|
||||||
|
/* TODO: What is this struct, really? It is presumably not ContentAttributes/has more fields. */
|
||||||
|
struct ContentAttributes {
|
||||||
|
fs::ContentAttributes content_attributes;
|
||||||
|
u8 unknown[0xF];
|
||||||
|
|
||||||
|
static constexpr ALWAYS_INLINE ContentAttributes Make(fs::ContentAttributes attr) {
|
||||||
|
return { attr, };
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static_assert(util::is_pod<ContentAttributes>::value);
|
||||||
|
static_assert(sizeof(ContentAttributes) == 0x10);
|
||||||
|
|
||||||
|
constexpr inline const ContentAttributes DefaultContentAttributes = ContentAttributes::Make(fs::ContentAttributes_None);
|
||||||
|
|
||||||
|
}
|
|
@ -14,15 +14,19 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#include <stratosphere/fs/fs_content_attributes.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_id.hpp>
|
#include <stratosphere/ncm/ncm_content_id.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_type.hpp>
|
#include <stratosphere/ncm/ncm_content_type.hpp>
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
struct ContentInfo {
|
struct ContentInfo {
|
||||||
|
static constexpr fs::ContentAttributes DefaultContentAttributes = fs::ContentAttributes_None;
|
||||||
|
|
||||||
ContentId content_id;
|
ContentId content_id;
|
||||||
u32 size_low;
|
u32 size_low;
|
||||||
u16 size_high;
|
u8 size_high;
|
||||||
|
u8 content_attributes;
|
||||||
ContentType content_type;
|
ContentType content_type;
|
||||||
u8 id_offset;
|
u8 id_offset;
|
||||||
|
|
||||||
|
@ -34,6 +38,10 @@ namespace ams::ncm {
|
||||||
return (static_cast<u64>(this->size_high) << 32) | static_cast<u64>(this->size_low);
|
return (static_cast<u64>(this->size_high) << 32) | static_cast<u64>(this->size_low);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr fs::ContentAttributes GetContentAttributes() const {
|
||||||
|
return static_cast<fs::ContentAttributes>(this->content_attributes & 0xF);
|
||||||
|
}
|
||||||
|
|
||||||
constexpr ContentType GetType() const {
|
constexpr ContentType GetType() const {
|
||||||
return this->content_type;
|
return this->content_type;
|
||||||
}
|
}
|
||||||
|
@ -42,15 +50,16 @@ namespace ams::ncm {
|
||||||
return this->id_offset;
|
return this->id_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
static constexpr ContentInfo Make(ContentId id, u64 size, ContentType type, u8 id_ofs = 0) {
|
static constexpr ContentInfo Make(ContentId id, u64 size, fs::ContentAttributes attr, ContentType type, u8 id_ofs = 0) {
|
||||||
const u32 size_low = size & 0xFFFFFFFFu;
|
const u32 size_low = size & 0xFFFFFFFFu;
|
||||||
const u16 size_high = static_cast<u16>(size >> 32);
|
const u8 size_high = static_cast<u8>(size >> 32);
|
||||||
return {
|
return {
|
||||||
.content_id = id,
|
.content_id = id,
|
||||||
.size_low = size_low,
|
.size_low = size_low,
|
||||||
.size_high = size_high,
|
.size_high = size_high,
|
||||||
.content_type = type,
|
.content_attributes = attr,
|
||||||
.id_offset = id_ofs,
|
.content_type = type,
|
||||||
|
.id_offset = id_ofs,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -40,6 +40,10 @@ namespace ams::ncm {
|
||||||
return this->info.GetId();
|
return this->info.GetId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr fs::ContentAttributes GetContentAttributes() const {
|
||||||
|
return this->info.GetContentAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
constexpr ContentType GetType() const {
|
constexpr ContentType GetType() const {
|
||||||
return this->info.GetType();
|
return this->info.GetType();
|
||||||
}
|
}
|
||||||
|
@ -72,6 +76,10 @@ namespace ams::ncm {
|
||||||
return this->info.GetSize();
|
return this->info.GetSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr fs::ContentAttributes GetContentAttributes() const {
|
||||||
|
return this->info.GetContentAttributes();
|
||||||
|
}
|
||||||
|
|
||||||
constexpr ContentType GetType() const {
|
constexpr ContentType GetType() const {
|
||||||
return this->info.GetType();
|
return this->info.GetType();
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,6 +97,14 @@ namespace ams::ncm {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AddOnContentMetaExtendedHeader {
|
struct AddOnContentMetaExtendedHeader {
|
||||||
|
ApplicationId application_id;
|
||||||
|
u32 required_application_version;
|
||||||
|
u8 content_accessibilities;
|
||||||
|
u8 padding[3];
|
||||||
|
u64 data_patch_id; /* TODO: DataPatchId? */
|
||||||
|
};
|
||||||
|
|
||||||
|
struct LegacyAddOnContentMetaExtendedHeader {
|
||||||
ApplicationId application_id;
|
ApplicationId application_id;
|
||||||
u32 required_application_version;
|
u32 required_application_version;
|
||||||
u32 padding;
|
u32 padding;
|
||||||
|
|
|
@ -58,15 +58,25 @@ namespace ams::ncm {
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
#define AMS_NCM_DEFINE_GETTERS(Kind, IdType) \
|
||||||
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
Result Get##Kind(ContentId *out, IdType##Id id, u32 version) { \
|
||||||
R_RETURN(m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind)); \
|
R_RETURN(m_interface->GetContentIdByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind)); \
|
||||||
} \
|
} \
|
||||||
\
|
\
|
||||||
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
Result Get##Kind(ContentInfo *out, IdType##Id id, u32 version) { \
|
||||||
ContentMetaKey latest_key; \
|
R_RETURN(m_interface->GetContentInfoByType(out, ContentMetaKey::MakeUnknownType(id.value, version), ContentType::Kind)); \
|
||||||
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
} \
|
||||||
R_RETURN(m_interface->GetContentIdByType(out, latest_key, ContentType::Kind)); \
|
\
|
||||||
|
Result GetLatest##Kind(ContentId *out, IdType##Id id) { \
|
||||||
|
ContentMetaKey latest_key; \
|
||||||
|
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||||
|
R_RETURN(m_interface->GetContentIdByType(out, latest_key, ContentType::Kind)); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
Result GetLatest##Kind(ContentInfo *out, IdType##Id id) { \
|
||||||
|
ContentMetaKey latest_key; \
|
||||||
|
R_TRY(m_interface->GetLatestContentMetaKey(std::addressof(latest_key), id.value)); \
|
||||||
|
R_RETURN(m_interface->GetContentInfoByType(out, latest_key, ContentType::Kind)); \
|
||||||
}
|
}
|
||||||
|
|
||||||
AMS_NCM_DEFINE_GETTERS(Program, Program)
|
AMS_NCM_DEFINE_GETTERS(Program, Program)
|
||||||
|
@ -189,6 +199,21 @@ namespace ams::ncm {
|
||||||
AMS_ASSERT(m_interface != nullptr);
|
AMS_ASSERT(m_interface != nullptr);
|
||||||
R_RETURN(m_interface->GetRequiredApplicationVersion(out_version, key));
|
R_RETURN(m_interface->GetRequiredApplicationVersion(out_version, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result GetContentAccessibilities(u8 *out_accessibilities, const ContentMetaKey &key) {
|
||||||
|
AMS_ASSERT(m_interface != nullptr);
|
||||||
|
R_RETURN(m_interface->GetContentAccessibilities(out_accessibilities, key));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetContentInfoByType(ContentInfo *out_content_info, const ContentMetaKey &key, ContentType type) {
|
||||||
|
AMS_ASSERT(m_interface != nullptr);
|
||||||
|
R_RETURN(m_interface->GetContentInfoByType(out_content_info, key, type));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetContentInfoByTypeAndIdOffset(ContentInfo *out_content_info, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||||
|
AMS_ASSERT(m_interface != nullptr);
|
||||||
|
R_RETURN(m_interface->GetContentInfoByTypeAndIdOffset(out_content_info, key, type, id_offset));
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,29 +17,33 @@
|
||||||
#include <stratosphere/sf.hpp>
|
#include <stratosphere/sf.hpp>
|
||||||
#include <stratosphere/ncm/ncm_content_meta.hpp>
|
#include <stratosphere/ncm/ncm_content_meta.hpp>
|
||||||
|
|
||||||
#define AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO(C, H) \
|
#define AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO(C, H) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 0, Result, Set, (const ncm::ContentMetaKey &key, const sf::InBuffer &value), (key, value)) \
|
AMS_SF_METHOD_INFO(C, H, 0, Result, Set, (const ncm::ContentMetaKey &key, const sf::InBuffer &value), (key, value)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 1, Result, Get, (sf::Out<u64> out_size, const ncm::ContentMetaKey &key, const sf::OutBuffer &out_value), (out_size, key, out_value)) \
|
AMS_SF_METHOD_INFO(C, H, 1, Result, Get, (sf::Out<u64> out_size, const ncm::ContentMetaKey &key, const sf::OutBuffer &out_value), (out_size, key, out_value)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 2, Result, Remove, (const ncm::ContentMetaKey &key), (key)) \
|
AMS_SF_METHOD_INFO(C, H, 2, Result, Remove, (const ncm::ContentMetaKey &key), (key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 3, Result, GetContentIdByType, (sf::Out<ncm::ContentId> out_content_id, const ncm::ContentMetaKey &key, ncm::ContentType type), (out_content_id, key, type)) \
|
AMS_SF_METHOD_INFO(C, H, 3, Result, GetContentIdByType, (sf::Out<ncm::ContentId> out_content_id, const ncm::ContentMetaKey &key, ncm::ContentType type), (out_content_id, key, type)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 4, Result, ListContentInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentInfo> &out_info, const ncm::ContentMetaKey &key, s32 offset), (out_entries_written, out_info, key, offset)) \
|
AMS_SF_METHOD_INFO(C, H, 4, Result, ListContentInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentInfo> &out_info, const ncm::ContentMetaKey &key, s32 offset), (out_entries_written, out_info, key, offset)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 5, Result, List, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentMetaKey> &out_info, ncm::ContentMetaType meta_type, ncm::ApplicationId application_id, u64 min, u64 max, ncm::ContentInstallType install_type), (out_entries_total, out_entries_written, out_info, meta_type, application_id, min, max, install_type)) \
|
AMS_SF_METHOD_INFO(C, H, 5, Result, List, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentMetaKey> &out_info, ncm::ContentMetaType meta_type, ncm::ApplicationId application_id, u64 min, u64 max, ncm::ContentInstallType install_type), (out_entries_total, out_entries_written, out_info, meta_type, application_id, min, max, install_type)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 6, Result, GetLatestContentMetaKey, (sf::Out<ncm::ContentMetaKey> out_key, u64 id), (out_key, id)) \
|
AMS_SF_METHOD_INFO(C, H, 6, Result, GetLatestContentMetaKey, (sf::Out<ncm::ContentMetaKey> out_key, u64 id), (out_key, id)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 7, Result, ListApplication, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ApplicationContentMetaKey> &out_keys, ncm::ContentMetaType meta_type), (out_entries_total, out_entries_written, out_keys, meta_type)) \
|
AMS_SF_METHOD_INFO(C, H, 7, Result, ListApplication, (sf::Out<s32> out_entries_total, sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ApplicationContentMetaKey> &out_keys, ncm::ContentMetaType meta_type), (out_entries_total, out_entries_written, out_keys, meta_type)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 8, Result, Has, (sf::Out<bool> out, const ncm::ContentMetaKey &key), (out, key)) \
|
AMS_SF_METHOD_INFO(C, H, 8, Result, Has, (sf::Out<bool> out, const ncm::ContentMetaKey &key), (out, key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 9, Result, HasAll, (sf::Out<bool> out, const sf::InArray<ncm::ContentMetaKey> &keys), (out, keys)) \
|
AMS_SF_METHOD_INFO(C, H, 9, Result, HasAll, (sf::Out<bool> out, const sf::InArray<ncm::ContentMetaKey> &keys), (out, keys)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 10, Result, GetSize, (sf::Out<u64> out_size, const ncm::ContentMetaKey &key), (out_size, key)) \
|
AMS_SF_METHOD_INFO(C, H, 10, Result, GetSize, (sf::Out<u64> out_size, const ncm::ContentMetaKey &key), (out_size, key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 11, Result, GetRequiredSystemVersion, (sf::Out<u32> out_version, const ncm::ContentMetaKey &key), (out_version, key)) \
|
AMS_SF_METHOD_INFO(C, H, 11, Result, GetRequiredSystemVersion, (sf::Out<u32> out_version, const ncm::ContentMetaKey &key), (out_version, key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 12, Result, GetPatchId, (sf::Out<ncm::PatchId> out_patch_id, const ncm::ContentMetaKey &key), (out_patch_id, key)) \
|
AMS_SF_METHOD_INFO(C, H, 12, Result, GetPatchId, (sf::Out<ncm::PatchId> out_patch_id, const ncm::ContentMetaKey &key), (out_patch_id, key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 13, Result, DisableForcibly, (), ()) \
|
AMS_SF_METHOD_INFO(C, H, 13, Result, DisableForcibly, (), ()) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 14, Result, LookupOrphanContent, (const sf::OutArray<bool> &out_orphaned, const sf::InArray<ncm::ContentId> &content_ids), (out_orphaned, content_ids)) \
|
AMS_SF_METHOD_INFO(C, H, 14, Result, LookupOrphanContent, (const sf::OutArray<bool> &out_orphaned, const sf::InArray<ncm::ContentId> &content_ids), (out_orphaned, content_ids)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 15, Result, Commit, (), ()) \
|
AMS_SF_METHOD_INFO(C, H, 15, Result, Commit, (), ()) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 16, Result, HasContent, (sf::Out<bool> out, const ncm::ContentMetaKey &key, const ncm::ContentId &content_id), (out, key, content_id)) \
|
AMS_SF_METHOD_INFO(C, H, 16, Result, HasContent, (sf::Out<bool> out, const ncm::ContentMetaKey &key, const ncm::ContentId &content_id), (out, key, content_id)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 17, Result, ListContentMetaInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentMetaInfo> &out_meta_info, const ncm::ContentMetaKey &key, s32 offset), (out_entries_written, out_meta_info, key, offset)) \
|
AMS_SF_METHOD_INFO(C, H, 17, Result, ListContentMetaInfo, (sf::Out<s32> out_entries_written, const sf::OutArray<ncm::ContentMetaInfo> &out_meta_info, const ncm::ContentMetaKey &key, s32 offset), (out_entries_written, out_meta_info, key, offset)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 18, Result, GetAttributes, (sf::Out<u8> out_attributes, const ncm::ContentMetaKey &key), (out_attributes, key)) \
|
AMS_SF_METHOD_INFO(C, H, 18, Result, GetAttributes, (sf::Out<u8> out_attributes, const ncm::ContentMetaKey &key), (out_attributes, key)) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 19, Result, GetRequiredApplicationVersion, (sf::Out<u32> out_version, const ncm::ContentMetaKey &key), (out_version, key), hos::Version_2_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 19, Result, GetRequiredApplicationVersion, (sf::Out<u32> out_version, const ncm::ContentMetaKey &key), (out_version, key), hos::Version_2_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 20, Result, GetContentIdByTypeAndIdOffset, (sf::Out<ncm::ContentId> out_content_id, const ncm::ContentMetaKey &key, ncm::ContentType type, u8 id_offset), (out_content_id, key, type, id_offset), hos::Version_5_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 20, Result, GetContentIdByTypeAndIdOffset, (sf::Out<ncm::ContentId> out_content_id, const ncm::ContentMetaKey &key, ncm::ContentType type, u8 id_offset), (out_content_id, key, type, id_offset), hos::Version_5_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 21, Result, GetCount, (sf::Out<u32> out_count), (out_count), hos::Version_10_0_0) \
|
AMS_SF_METHOD_INFO(C, H, 21, Result, GetCount, (sf::Out<u32> out_count), (out_count), hos::Version_10_0_0) \
|
||||||
AMS_SF_METHOD_INFO(C, H, 22, Result, GetOwnerApplicationId, (sf::Out<ncm::ApplicationId> out_id, const ncm::ContentMetaKey &key), (out_id, key), hos::Version_10_0_0)
|
AMS_SF_METHOD_INFO(C, H, 22, Result, GetOwnerApplicationId, (sf::Out<ncm::ApplicationId> out_id, const ncm::ContentMetaKey &key), (out_id, key), hos::Version_10_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 23, Result, GetContentAccessibilities, (sf::Out<u8> out_accessibilities, const ncm::ContentMetaKey &key), (out_accessibilities, key), hos::Version_15_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 24, Result, GetContentInfoByType, (sf::Out<ncm::ContentInfo> out_content_info, const ncm::ContentMetaKey &key, ncm::ContentType type), (out_content_info, key, type), hos::Version_15_0_0) \
|
||||||
|
AMS_SF_METHOD_INFO(C, H, 25, Result, GetContentInfoByTypeAndIdOffset, (sf::Out<ncm::ContentInfo> out_content_info, const ncm::ContentMetaKey &key, ncm::ContentType type, u8 id_offset), (out_content_info, key, type, id_offset), hos::Version_15_0_0)
|
||||||
|
|
||||||
|
|
||||||
AMS_SF_DEFINE_INTERFACE(ams::ncm, IContentMetaDatabase, AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO, 0x58021FEC)
|
AMS_SF_DEFINE_INTERFACE(ams::ncm, IContentMetaDatabase, AMS_NCM_I_CONTENT_META_DATABASE_INTERFACE_INFO, 0x58021FEC)
|
||||||
|
|
|
@ -21,7 +21,7 @@ namespace ams::fs::impl {
|
||||||
#define ADD_ENUM_CASE(v) case v: return #v
|
#define ADD_ENUM_CASE(v) case v: return #v
|
||||||
|
|
||||||
template<> const char *IdString::ToString<pkg1::KeyGeneration>(pkg1::KeyGeneration id) {
|
template<> const char *IdString::ToString<pkg1::KeyGeneration>(pkg1::KeyGeneration id) {
|
||||||
static_assert(pkg1::KeyGeneration_Current == pkg1::KeyGeneration_14_0_0);
|
static_assert(pkg1::KeyGeneration_Current == pkg1::KeyGeneration_15_0_0);
|
||||||
switch (id) {
|
switch (id) {
|
||||||
using enum pkg1::KeyGeneration;
|
using enum pkg1::KeyGeneration;
|
||||||
case KeyGeneration_1_0_0: return "1.0.0-2.3.0";
|
case KeyGeneration_1_0_0: return "1.0.0-2.3.0";
|
||||||
|
@ -37,7 +37,8 @@ namespace ams::fs::impl {
|
||||||
case KeyGeneration_9_1_0: return "9.1.0-12.0.3";
|
case KeyGeneration_9_1_0: return "9.1.0-12.0.3";
|
||||||
case KeyGeneration_12_1_0: return "12.1.0";
|
case KeyGeneration_12_1_0: return "12.1.0";
|
||||||
case KeyGeneration_13_0_0: return "13.0.0-13.2.1";
|
case KeyGeneration_13_0_0: return "13.0.0-13.2.1";
|
||||||
case KeyGeneration_14_0_0: return "14.0.0-";
|
case KeyGeneration_14_0_0: return "14.0.0-14.1.2";
|
||||||
|
case KeyGeneration_15_0_0: return "15.0.0-";
|
||||||
default: return "Unknown";
|
default: return "Unknown";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,7 +114,7 @@ namespace ams::ncm {
|
||||||
R_TRY(storage->GetSize(std::addressof(size), content_id));
|
R_TRY(storage->GetSize(std::addressof(size), content_id));
|
||||||
|
|
||||||
/* Build. */
|
/* Build. */
|
||||||
R_TRY(this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(content_id, size, ContentType::Meta)));
|
R_TRY(this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(content_id, size, ContentInfo::DefaultContentAttributes, ContentType::Meta)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ namespace ams::ncm {
|
||||||
R_UNLESS(content_id, ncm::ResultInvalidPackageFormat());
|
R_UNLESS(content_id, ncm::ResultInvalidPackageFormat());
|
||||||
|
|
||||||
/* Build using the meta. */
|
/* Build using the meta. */
|
||||||
R_RETURN(this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(*content_id, entry.file_size, ContentType::Meta)));
|
R_RETURN(this->BuildFromPackageContentMeta(package_meta.Get(), package_meta.GetSize(), ContentInfo::Make(*content_id, entry.file_size, ContentInfo::DefaultContentAttributes, ContentType::Meta)));
|
||||||
}));
|
}));
|
||||||
|
|
||||||
/* Commit our changes. */
|
/* Commit our changes. */
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
namespace ams::ncm {
|
namespace ams::ncm {
|
||||||
|
|
||||||
Result ContentMetaDatabaseImpl::GetContentIdImpl(ContentId *out, const ContentMetaKey &key, ContentType type, util::optional<u8> id_offset) const {
|
Result ContentMetaDatabaseImpl::GetContentInfoImpl(ContentInfo *out, const ContentMetaKey &key, ContentType type, util::optional<u8> id_offset) const {
|
||||||
R_TRY(this->EnsureEnabled());
|
R_TRY(this->EnsureEnabled());
|
||||||
|
|
||||||
/* Find the meta key. */
|
/* Find the meta key. */
|
||||||
|
@ -45,7 +45,7 @@ namespace ams::ncm {
|
||||||
R_UNLESS(content_info != nullptr, ncm::ResultContentNotFound());
|
R_UNLESS(content_info != nullptr, ncm::ResultContentNotFound());
|
||||||
|
|
||||||
/* Save output. */
|
/* Save output. */
|
||||||
*out = content_info->content_id;
|
*out = *content_info;
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -481,4 +481,31 @@ namespace ams::ncm {
|
||||||
R_SUCCEED();
|
R_SUCCEED();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result ContentMetaDatabaseImpl::GetContentAccessibilities(sf::Out<u8> out_accessibilities, const ContentMetaKey &key) {
|
||||||
|
R_TRY(this->EnsureEnabled());
|
||||||
|
|
||||||
|
/* Ensure this type of key is for an add-on content. */
|
||||||
|
R_UNLESS(key.type == ContentMetaType::AddOnContent, ncm::ResultInvalidContentMetaKey());
|
||||||
|
|
||||||
|
/* Obtain the content meta for the key. */
|
||||||
|
const void *meta;
|
||||||
|
size_t meta_size;
|
||||||
|
R_TRY(this->GetContentMetaPointer(&meta, &meta_size, key));
|
||||||
|
|
||||||
|
/* Create a reader. */
|
||||||
|
ContentMetaReader reader(meta, meta_size);
|
||||||
|
|
||||||
|
/* Set the ouput value. */
|
||||||
|
out_accessibilities.SetValue(reader.GetExtendedHeader<AddOnContentMetaExtendedHeader>()->content_accessibilities);
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ContentMetaDatabaseImpl::GetContentInfoByType(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type) {
|
||||||
|
R_RETURN(this->GetContentInfoImpl(out_content_info.GetPointer(), key, type, util::nullopt));
|
||||||
|
}
|
||||||
|
|
||||||
|
Result ContentMetaDatabaseImpl::GetContentInfoByTypeAndIdOffset(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||||
|
R_RETURN(this->GetContentInfoImpl(out_content_info.GetPointer(), key, type, util::make_optional(id_offset)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,17 @@ namespace ams::ncm {
|
||||||
ContentMetaDatabaseImpl(ContentMetaKeyValueStore *kvs) : ContentMetaDatabaseImplBase(kvs) { /* ... */ }
|
ContentMetaDatabaseImpl(ContentMetaKeyValueStore *kvs) : ContentMetaDatabaseImplBase(kvs) { /* ... */ }
|
||||||
private:
|
private:
|
||||||
/* Helpers. */
|
/* Helpers. */
|
||||||
Result GetContentIdImpl(ContentId *out, const ContentMetaKey &key, ContentType type, util::optional<u8> id_offset) const;
|
Result GetContentInfoImpl(ContentInfo *out, const ContentMetaKey &key, ContentType type, util::optional<u8> id_offset) const;
|
||||||
|
|
||||||
|
Result GetContentIdImpl(ContentId *out, const ContentMetaKey &key, ContentType type, util::optional<u8> id_offset) const {
|
||||||
|
/* Get the content info. */
|
||||||
|
ContentInfo content_info;
|
||||||
|
R_TRY(this->GetContentInfoImpl(std::addressof(content_info), key, type, id_offset));
|
||||||
|
|
||||||
|
/* Set the output id. */
|
||||||
|
*out = content_info.GetId();
|
||||||
|
R_SUCCEED();
|
||||||
|
}
|
||||||
public:
|
public:
|
||||||
/* Actual commands. */
|
/* Actual commands. */
|
||||||
virtual Result Set(const ContentMetaKey &key, const sf::InBuffer &value) override;
|
virtual Result Set(const ContentMetaKey &key, const sf::InBuffer &value) override;
|
||||||
|
@ -51,6 +61,9 @@ namespace ams::ncm {
|
||||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override;
|
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override;
|
||||||
virtual Result GetCount(sf::Out<u32> out_count) override;
|
virtual Result GetCount(sf::Out<u32> out_count) override;
|
||||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) override;
|
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) override;
|
||||||
|
virtual Result GetContentAccessibilities(sf::Out<u8> out_accessibilities, const ContentMetaKey &key) override;
|
||||||
|
virtual Result GetContentInfoByType(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type) override;
|
||||||
|
virtual Result GetContentInfoByTypeAndIdOffset(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type, u8 id_offset) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,6 +77,9 @@ namespace ams::ncm {
|
||||||
virtual Result GetContentIdByTypeAndIdOffset(sf::Out<ContentId> out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) = 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 GetCount(sf::Out<u32> out_count) = 0;
|
||||||
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) = 0;
|
virtual Result GetOwnerApplicationId(sf::Out<ApplicationId> out_id, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetContentAccessibilities(sf::Out<u8> out_accessibilities, const ContentMetaKey &key) = 0;
|
||||||
|
virtual Result GetContentInfoByType(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type) = 0;
|
||||||
|
virtual Result GetContentInfoByTypeAndIdOffset(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type, u8 id_offset) = 0;
|
||||||
};
|
};
|
||||||
static_assert(ncm::IsIContentMetaDatabase<ContentMetaDatabaseImplBase>);
|
static_assert(ncm::IsIContentMetaDatabase<ContentMetaDatabaseImplBase>);
|
||||||
|
|
||||||
|
|
|
@ -790,7 +790,7 @@ namespace ams::ncm {
|
||||||
R_TRY(tmp_buffer.Initialize(reader.CalculateConvertInstallContentMetaSize()));
|
R_TRY(tmp_buffer.Initialize(reader.CalculateConvertInstallContentMetaSize()));
|
||||||
|
|
||||||
/* Convert packaged content meta to install content meta. */
|
/* Convert packaged content meta to install content meta. */
|
||||||
reader.ConvertToInstallContentMeta(tmp_buffer.Get(), tmp_buffer.GetSize(), InstallContentInfo::Make(ContentInfo::Make(content_id, size, ContentType::Meta), meta_type));
|
reader.ConvertToInstallContentMeta(tmp_buffer.Get(), tmp_buffer.GetSize(), InstallContentInfo::Make(ContentInfo::Make(content_id, size, ContentInfo::DefaultContentAttributes, ContentType::Meta), meta_type));
|
||||||
|
|
||||||
/* Push the content meta. */
|
/* Push the content meta. */
|
||||||
m_data->Push(tmp_buffer.Get(), tmp_buffer.GetSize());
|
m_data->Push(tmp_buffer.Get(), tmp_buffer.GetSize());
|
||||||
|
@ -1028,7 +1028,7 @@ namespace ams::ncm {
|
||||||
InstallContentInfo InstallTaskBase::MakeInstallContentInfoFrom(const InstallContentMetaInfo &info, const PlaceHolderId &placeholder_id, util::optional<bool> is_tmp) {
|
InstallContentInfo InstallTaskBase::MakeInstallContentInfoFrom(const InstallContentMetaInfo &info, const PlaceHolderId &placeholder_id, util::optional<bool> is_tmp) {
|
||||||
return {
|
return {
|
||||||
.digest = info.digest,
|
.digest = info.digest,
|
||||||
.info = ContentInfo::Make(info.content_id, info.content_size, ContentType::Meta, 0),
|
.info = ContentInfo::Make(info.content_id, info.content_size, ContentInfo::DefaultContentAttributes, ContentType::Meta, 0),
|
||||||
.placeholder_id = placeholder_id,
|
.placeholder_id = placeholder_id,
|
||||||
.meta_type = info.key.type,
|
.meta_type = info.key.type,
|
||||||
.install_state = InstallState::Prepared,
|
.install_state = InstallState::Prepared,
|
||||||
|
|
|
@ -168,6 +168,24 @@ namespace ams::ncm {
|
||||||
AMS_UNUSED(out_id, key);
|
AMS_UNUSED(out_id, key);
|
||||||
AMS_ABORT();
|
AMS_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result GetContentAccessibilities(sf::Out<u8> out_accessibilities, const ContentMetaKey &key) {
|
||||||
|
/* TODO: libnx bindings */
|
||||||
|
AMS_UNUSED(out_accessibilities, key);
|
||||||
|
AMS_ABORT();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetContentInfoByType(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type) {
|
||||||
|
/* TODO: libnx bindings */
|
||||||
|
AMS_UNUSED(out_content_info, key, type);
|
||||||
|
AMS_ABORT();
|
||||||
|
}
|
||||||
|
|
||||||
|
Result GetContentInfoByTypeAndIdOffset(sf::Out<ContentInfo> out_content_info, const ContentMetaKey &key, ContentType type, u8 id_offset) {
|
||||||
|
/* TODO: libnx bindings */
|
||||||
|
AMS_UNUSED(out_content_info, key, type, id_offset);
|
||||||
|
AMS_ABORT();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
static_assert(ncm::IsIContentMetaDatabase<RemoteContentMetaDatabaseImpl>);
|
static_assert(ncm::IsIContentMetaDatabase<RemoteContentMetaDatabaseImpl>);
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue