From e96c84f1f07180b8fca981299dbb96658b473a64 Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Wed, 4 Mar 2020 19:35:51 -0800 Subject: [PATCH] ncm: minor fixes --- .../stratosphere/kvdb/kvdb_file_key_value_cache.hpp | 2 +- .../include/stratosphere/ncm/ncm_content_meta.hpp | 2 +- .../stratosphere/ncm/ncm_content_meta_database.hpp | 4 ++-- .../stratosphere/ncm/ncm_i_content_meta_database.hpp | 2 +- .../include/stratosphere/ncm/ncm_types.hpp | 8 ++++---- libraries/libstratosphere/source/boot2/boot2_api.cpp | 1 - .../source/ncm/ncm_remote_content_meta_database_impl.hpp | 4 ++-- .../ncm/source/ncm_content_meta_database_impl.cpp | 2 +- .../ncm/source/ncm_content_meta_database_impl.hpp | 2 +- 9 files changed, 13 insertions(+), 14 deletions(-) diff --git a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp index f3e969440..f69b9ab26 100644 --- a/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp +++ b/libraries/libstratosphere/include/stratosphere/kvdb/kvdb_file_key_value_cache.hpp @@ -236,7 +236,7 @@ namespace ams::kvdb { static Result CreateNewCache(const char *dir) { /* Make a new key value store filesystem, and a new lru_list.dat. */ R_TRY(LeastRecentlyUsedList::CreateNewList(GetLeastRecentlyUsedListPath(dir))); - R_UNLESS(mkdir(GetFileKeyValueStorePath(dir), 0) == 0, fsdevGetLastResult()); + R_TRY(fs::CreateDirectory(dir)); return ResultSuccess(); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta.hpp index 836ee56e6..e4184a80d 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta.hpp @@ -23,7 +23,7 @@ namespace ams::ncm { u16 extended_header_size; u16 content_count; u16 content_meta_count; - ContentMetaAttribute attributes; + u8 attributes; StorageId storage_id; }; diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp index b3c9e3e20..99616adc1 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_content_meta_database.hpp @@ -103,7 +103,7 @@ namespace ams::ncm { return lc; } - ListCount ListContentMeta(ContentMetaKey *dst, size_t dst_size, ContentMetaType type, ProgramId app_id, ProgramId min, ProgramId max, ContentInstallType install_type) { + ListCount ListContentMeta(ContentMetaKey *dst, size_t dst_size, ContentMetaType type, ProgramId app_id = InvalidProgramId, ProgramId min = {std::numeric_limits::min()}, ProgramId max = {std::numeric_limits::max()}, ContentInstallType install_type = ContentInstallType::Full) { ListCount lc = {}; R_ABORT_UNLESS(this->interface->List(std::addressof(lc.total), std::addressof(lc.written), sf::OutArray(dst, dst_size), type, app_id, min, max, install_type)); return lc; @@ -173,7 +173,7 @@ namespace ams::ncm { return this->interface->Commit(); } - Result GetAttributes(ContentMetaAttribute *out_attributes, const ContentMetaKey &key) { + Result GetAttributes(u8 *out_attributes, const ContentMetaKey &key) { AMS_ASSERT(this->interface != nullptr); return this->interface->GetAttributes(out_attributes, key); } diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_meta_database.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_meta_database.hpp index fee22c2fc..3df31dc3b 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_meta_database.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_i_content_meta_database.hpp @@ -66,7 +66,7 @@ namespace ams::ncm { virtual Result Commit() = 0; virtual Result HasContent(sf::Out out, const ContentMetaKey &key, const ContentId &content_id) = 0; virtual Result ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, const ContentMetaKey &key, u32 start_index) = 0; - virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) = 0; + virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) = 0; virtual Result GetRequiredApplicationVersion(sf::Out out_version, const ContentMetaKey &key) = 0; virtual Result GetContentIdByTypeAndIdOffset(sf::Out out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) = 0; public: diff --git a/libraries/libstratosphere/include/stratosphere/ncm/ncm_types.hpp b/libraries/libstratosphere/include/stratosphere/ncm/ncm_types.hpp index 0cd3f52db..912519b76 100644 --- a/libraries/libstratosphere/include/stratosphere/ncm/ncm_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/ncm/ncm_types.hpp @@ -43,10 +43,10 @@ namespace ams::ncm { DeltaFragment = 6, }; - enum class ContentMetaAttribute : u8 { - None = 0, - IncludesExFatDriver = 1, - Rebootless = 2, + enum ContentMetaAttribute : u8 { + ContentMetaAttribute_None = (0 << 0), + ContentMetaAttribute_IncludesExFatDriver = (1 << 0), + ContentMetaAttribute_Rebootless = (1 << 1), }; enum class ContentInstallType : u8 { diff --git a/libraries/libstratosphere/source/boot2/boot2_api.cpp b/libraries/libstratosphere/source/boot2/boot2_api.cpp index 3ec5e9805..29b0ff0e6 100644 --- a/libraries/libstratosphere/source/boot2/boot2_api.cpp +++ b/libraries/libstratosphere/source/boot2/boot2_api.cpp @@ -13,7 +13,6 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -#include #include namespace ams::boot2 { diff --git a/libraries/libstratosphere/source/ncm/ncm_remote_content_meta_database_impl.hpp b/libraries/libstratosphere/source/ncm/ncm_remote_content_meta_database_impl.hpp index ccbb0ada8..92b4d3944 100644 --- a/libraries/libstratosphere/source/ncm/ncm_remote_content_meta_database_impl.hpp +++ b/libraries/libstratosphere/source/ncm/ncm_remote_content_meta_database_impl.hpp @@ -144,9 +144,9 @@ namespace ams::ncm { return ncmContentMetaDatabaseListContentMetaInfo(std::addressof(this->srv), reinterpret_cast(out_entries_written.GetPointer()), out_meta_info.GetPointer(), out_meta_info.GetSize(), Convert(key), start_index); } - virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) override { + virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) override { static_assert(sizeof(ContentMetaAttribute) == sizeof(u8)); - return ncmContentMetaDatabaseGetAttributes(std::addressof(this->srv), Convert(key), reinterpret_cast(out_attributes.GetPointer())); + return ncmContentMetaDatabaseGetAttributes(std::addressof(this->srv), Convert(key), out_attributes.GetPointer()); } virtual Result GetRequiredApplicationVersion(sf::Out out_version, const ContentMetaKey &key) override { diff --git a/stratosphere/ncm/source/ncm_content_meta_database_impl.cpp b/stratosphere/ncm/source/ncm_content_meta_database_impl.cpp index e76aad429..86411dffc 100644 --- a/stratosphere/ncm/source/ncm_content_meta_database_impl.cpp +++ b/stratosphere/ncm/source/ncm_content_meta_database_impl.cpp @@ -333,7 +333,7 @@ namespace ams::ncm { return ResultSuccess(); } - Result ContentMetaDatabaseImpl::GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) { + Result ContentMetaDatabaseImpl::GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) { R_TRY(this->EnsureEnabled()); const void *meta; diff --git a/stratosphere/ncm/source/ncm_content_meta_database_impl.hpp b/stratosphere/ncm/source/ncm_content_meta_database_impl.hpp index f6c3499fe..24c4710ec 100644 --- a/stratosphere/ncm/source/ncm_content_meta_database_impl.hpp +++ b/stratosphere/ncm/source/ncm_content_meta_database_impl.hpp @@ -47,7 +47,7 @@ namespace ams::ncm { virtual Result Commit() override; virtual Result HasContent(sf::Out out, const ContentMetaKey &key, const ContentId &content_id) override; virtual Result ListContentMetaInfo(sf::Out out_entries_written, const sf::OutArray &out_meta_info, const ContentMetaKey &key, u32 start_index) override; - virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) override; + virtual Result GetAttributes(sf::Out out_attributes, const ContentMetaKey &key) override; virtual Result GetRequiredApplicationVersion(sf::Out out_version, const ContentMetaKey &key) override; virtual Result GetContentIdByTypeAndIdOffset(sf::Out out_content_id, const ContentMetaKey &key, ContentType type, u8 id_offset) override; };