diff --git a/libraries/libstratosphere/include/stratosphere/sprofile/sprofile_types.hpp b/libraries/libstratosphere/include/stratosphere/sprofile/sprofile_types.hpp index 362a823cd..3fa6a84a8 100644 --- a/libraries/libstratosphere/include/stratosphere/sprofile/sprofile_types.hpp +++ b/libraries/libstratosphere/include/stratosphere/sprofile/sprofile_types.hpp @@ -18,18 +18,18 @@ namespace ams::sprofile { - struct Identifier { + struct HashKey { u8 data[7]; - friend bool operator==(const Identifier &lhs, const Identifier &rhs) { + friend bool operator==(const HashKey &lhs, const HashKey &rhs) { return std::memcmp(lhs.data, rhs.data, sizeof(lhs.data)) == 0; } - friend bool operator!=(const Identifier &lhs, const Identifier &rhs) { + friend bool operator!=(const HashKey &lhs, const HashKey &rhs) { return !(lhs == rhs); } }; - static_assert(sizeof(Identifier) == 7); - static_assert(util::is_pod::value); + static_assert(sizeof(HashKey) == 7); + static_assert(util::is_pod::value); } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_controller_for_debug.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_controller_for_debug.hpp index 7d51c7df2..4713e7894 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_controller_for_debug.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_controller_for_debug.hpp @@ -17,8 +17,8 @@ #include #define AMS_SPROFILE_I_PROFILE_CONTROLLER_FOR_DEBUG_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 2000, Result, Reset, (), ()) \ - AMS_SF_METHOD_INFO(C, H, 2001, Result, GetRaw, (sf::Out out_type, sf::Out out_value, sprofile::Identifier profile, sprofile::Identifier key), (out_type, out_value, profile, key)) - + AMS_SF_METHOD_INFO(C, H, 2000, Result, ClearSaveData, (), ()) \ + AMS_SF_METHOD_INFO(C, H, 2001, Result, QueryValue, (sf::Out out_type, sf::Out out_value, sprofile::HashKey profile, sprofile::HashKey key), (out_type, out_value, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 2002, Result, QueryValueArray, (sf::Out out_type, sf::Out out_count, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out_type, out_count, out_buffer, profile, key), hos::Version_23_0_0) AMS_SF_DEFINE_INTERFACE(ams::sprofile::srv, IProfileControllerForDebug, AMS_SPROFILE_I_PROFILE_CONTROLLER_FOR_DEBUG_INTERFACE_INFO, 0xA8C14F64) diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_importer.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_importer.hpp index 8d0c2b32b..5c07e9b81 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_importer.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_importer.hpp @@ -18,8 +18,8 @@ #include "sprofile_srv_types.hpp" #define AMS_SPROFILE_I_PROFILE_IMPORTER_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 0, Result, ImportProfile, (const sprofile::srv::ProfileDataForImportData &import), (import)) \ - AMS_SF_METHOD_INFO(C, H, 1, Result, Commit, (), ()) \ - AMS_SF_METHOD_INFO(C, H, 2, Result, ImportMetadata, (const sprofile::srv::ProfileMetadataForImportMetadata &import), (import)) \ + AMS_SF_METHOD_INFO(C, H, 0, Result, ImportProfile, (const sprofile::srv::ProfilePayload &import), (import)) \ + AMS_SF_METHOD_INFO(C, H, 1, Result, Commit, (), (), hos::Version_13_0_0, hos::Version_22_5_0) \ + AMS_SF_METHOD_INFO(C, H, 2, Result, ImportMetadata, (const sprofile::srv::MetadataPayload &import), (import), hos::Version_13_0_0, hos::Version_22_5_0) AMS_SF_DEFINE_INTERFACE(ams::sprofile::srv, IProfileImporter, AMS_SPROFILE_I_PROFILE_IMPORTER_INTERFACE_INFO, 0x1629C4E6) diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_reader.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_reader.hpp index e9a48faae..699c99a63 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_reader.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_reader.hpp @@ -17,10 +17,18 @@ #include #define AMS_SPROFILE_I_PROFILE_READER_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 0, Result, GetSigned64, (sf::Out out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \ - AMS_SF_METHOD_INFO(C, H, 1, Result, GetUnsigned64, (sf::Out out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \ - AMS_SF_METHOD_INFO(C, H, 2, Result, GetSigned32, (sf::Out out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \ - AMS_SF_METHOD_INFO(C, H, 3, Result, GetUnsigned32, (sf::Out out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) \ - AMS_SF_METHOD_INFO(C, H, 4, Result, GetByte, (sf::Out out, sprofile::Identifier profile, sprofile::Identifier key), (out, profile, key)) + AMS_SF_METHOD_INFO(C, H, 0, Result, GetInt64Value, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 1, Result, GetUInt64Value, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 2, Result, GetInt32Value, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 3, Result, GetUInt32Value, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 4, Result, GetBooleanValue, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key)) \ + AMS_SF_METHOD_INFO(C, H, 5, Result, GetAnyValue, (sf::Out out, sprofile::HashKey profile, sprofile::HashKey key), (out, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 6, Result, GetInt8ValueArray, (sf::Out out, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 7, Result, GetInt64ValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 8, Result, GetUInt64ValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 9, Result, GetInt32ValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 10, Result, GetUInt32ValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 11, Result, GetUInt8ValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) \ + AMS_SF_METHOD_INFO(C, H, 12, Result, GetAnyValueArray, (sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key), (out, out_buffer, profile, key), hos::Version_23_0_0) AMS_SF_DEFINE_INTERFACE(ams::sprofile::srv, IProfileReader, AMS_SPROFILE_I_PROFILE_READER_INTERFACE_INFO, 0x97090D4D) diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_update_observer.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_update_observer.hpp index ab68ad3bf..1f5b1d6fa 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_update_observer.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_profile_update_observer.hpp @@ -17,8 +17,8 @@ #include #define AMS_SPROFILE_I_PROFILE_UPDATE_OBSERVER_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 0, Result, Listen, (sprofile::Identifier profile), (profile)) \ - AMS_SF_METHOD_INFO(C, H, 1, Result, Unlisten, (sprofile::Identifier profile), (profile)) \ - AMS_SF_METHOD_INFO(C, H, 2, Result, GetEventHandle, (ams::sf::OutCopyHandle out), (out)) + AMS_SF_METHOD_INFO(C, H, 0, Result, Subscribe, (sprofile::HashKey profile), (profile)) \ + AMS_SF_METHOD_INFO(C, H, 1, Result, Unsubscribe, (sprofile::HashKey profile), (profile)) \ + AMS_SF_METHOD_INFO(C, H, 2, Result, GetUpdateEventNativeHandle, (ams::sf::OutCopyHandle out), (out)) AMS_SF_DEFINE_INTERFACE(ams::sprofile::srv, IProfileUpdateObserver, AMS_SPROFILE_I_PROFILE_UPDATE_OBSERVER_INTERFACE_INFO, 0xB52A765C) diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_service_for_bg_agent.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_service_for_bg_agent.hpp index 5edce1d7d..e0f86adca 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_service_for_bg_agent.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_i_service_for_bg_agent.hpp @@ -17,10 +17,10 @@ #include #include "sprofile_srv_i_profile_importer.hpp" -#define AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_BG_AGENT_INTERFACE_INFO(C, H) \ - AMS_SF_METHOD_INFO(C, H, 100, Result, OpenProfileImporter, (sf::Out> out), (out)) \ - AMS_SF_METHOD_INFO(C, H, 200, Result, GetImportableProfileUrls, (sf::Out out_count, const sf::OutArray &out, const sprofile::srv::ProfileMetadataForImportMetadata &arg), (out_count, out, arg)) \ - AMS_SF_METHOD_INFO(C, H, 201, Result, IsUpdateNeeded, (sf::Out out, sprofile::Identifier revision_key), (out, revision_key)) \ - AMS_SF_METHOD_INFO(C, H, 2000, Result, Reset, (), ()) +#define AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_BG_AGENT_INTERFACE_INFO(C, H) \ + AMS_SF_METHOD_INFO(C, H, 100, Result, OpenProfileImporter, (sf::Out> out), (out)) \ + AMS_SF_METHOD_INFO(C, H, 200, Result, GetProfileDownloadUrlList, (sf::Out out_count, const sf::OutArray &out, const sprofile::srv::MetadataPayload &arg), (out_count, out, arg), hos::Version_13_0_0, hos::Version_22_5_0) \ + AMS_SF_METHOD_INFO(C, H, 201, Result, GetMetadataNewness, (sf::Out out, sprofile::HashKey revision_key), (out, revision_key), hos::Version_13_0_0, hos::Version_22_5_0) \ + AMS_SF_METHOD_INFO(C, H, 2000, Result, ClearSaveDataForTest, (), ()) AMS_SF_DEFINE_INTERFACE(ams::sprofile::srv, ISprofileServiceForBgAgent, AMS_SPROFILE_I_SPROFILE_SERVICE_FOR_BG_AGENT_INTERFACE_INFO, 0xCCD828EC) diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.cpp index 1bf965f21..af31ba30c 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.cpp @@ -19,12 +19,18 @@ namespace ams::sprofile::srv { - Result ProfileControllerForDebugImpl::Reset() { + Result ProfileControllerForDebugImpl::ClearSaveData() { R_RETURN(m_manager->ResetSaveData()); } - Result ProfileControllerForDebugImpl::GetRaw(sf::Out out_type, sf::Out out_value, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetRaw(out_type.GetPointer(), out_value.GetPointer(), profile, key)); + Result ProfileControllerForDebugImpl::QueryValue(sf::Out out_type, sf::Out out_value, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->QueryValue(out_type.GetPointer(), out_value.GetPointer(), profile, key)); + } + + Result ProfileControllerForDebugImpl::QueryValueArray(sf::Out out_type, sf::Out out_count, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out_type, out_count, out_buffer, profile, key); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.hpp index edb9d9eb2..1a6bb7cd6 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_controller_for_debug_impl.hpp @@ -27,8 +27,9 @@ namespace ams::sprofile::srv { public: ProfileControllerForDebugImpl(ProfileManager *manager) : m_manager(manager) { /* ... */ } public: - Result Reset(); - Result GetRaw(sf::Out out_type, sf::Out out_value, sprofile::Identifier profile, sprofile::Identifier key); + Result ClearSaveData(); + Result QueryValue(sf::Out out_type, sf::Out out_value, sprofile::HashKey profile, sprofile::HashKey key); + Result QueryValueArray(sf::Out out_type, sf::Out out_count, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); }; static_assert(IsIProfileControllerForDebug); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer.hpp index 20df0fbe2..c2e5a5c00 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer.hpp @@ -22,8 +22,8 @@ namespace ams::sprofile::srv { class ProfileImporter { private: struct ImportingProfile { - Identifier identifier_0; - Identifier identifier_1; + HashKey hash_key_0; + HashKey hash_key_1; bool is_new_import; }; private: @@ -33,7 +33,7 @@ namespace ams::sprofile::srv { util::optional m_metadata; ImportingProfile m_importing_profiles[50]; util::BitFlagSet<50> m_is_profile_importable; - Identifier m_revision_key; + HashKey m_revision_key; public: ProfileImporter(const util::optional &meta) : m_committed(false), m_imported_metadata(false), m_importing_count(0), m_metadata(util::nullopt), m_is_profile_importable(), m_revision_key() { if (meta.has_value()) { @@ -41,12 +41,12 @@ namespace ams::sprofile::srv { } } public: - bool HasProfile(Identifier id0, Identifier id1) { + bool HasProfile(HashKey id0, HashKey id1) { /* Require that we have metadata. */ if (m_metadata.has_value()) { for (auto i = 0u; i < std::min(m_metadata->num_entries, util::size(m_metadata->entries)); ++i) { const auto &entry = m_metadata->entries[i]; - if (entry.identifier_0 == id0 && entry.identifier_1 == id1) { + if (entry.hash_key_0 == id0 && entry.hash_key_1 == id1) { return true; } } @@ -80,23 +80,23 @@ namespace ams::sprofile::srv { for (auto i = 0; i < m_importing_count; ++i) { const auto &import_entry = meta.entries[i]; - const bool is_new_import = !this->HasProfile(import_entry.identifier_0, import_entry.identifier_1); + const bool is_new_import = !this->HasProfile(import_entry.hash_key_0, import_entry.hash_key_1); m_importing_profiles[i] = { - .identifier_0 = import_entry.identifier_0, - .identifier_1 = import_entry.identifier_1, + .hash_key_0 = import_entry.hash_key_0, + .hash_key_1 = import_entry.hash_key_1, .is_new_import = is_new_import, }; m_is_profile_importable[i] = is_new_import; } } - bool CanImportProfile(Identifier profile) { + bool CanImportProfile(HashKey profile) { /* Require that we imported metadata. */ if (m_imported_metadata) { /* Find the specified profile. */ for (auto i = 0; i < m_importing_count; ++i) { - if (m_importing_profiles[i].identifier_0 == profile) { + if (m_importing_profiles[i].hash_key_0 == profile) { /* Require the profile be importable. */ return m_is_profile_importable[i]; } @@ -107,10 +107,10 @@ namespace ams::sprofile::srv { return false; } - void OnImportProfile(Identifier profile) { + void OnImportProfile(HashKey profile) { /* Set the profile as not importable (as it's imported). */ for (auto i = 0; i < m_importing_count; ++i) { - if (m_importing_profiles[i].identifier_0 == profile) { + if (m_importing_profiles[i].hash_key_0 == profile) { m_is_profile_importable[i] = false; break; } @@ -135,15 +135,15 @@ namespace ams::sprofile::srv { int GetImportingCount() const { return m_importing_count; } const ImportingProfile &GetImportingProfile(int i) const { return m_importing_profiles[i]; } - Identifier GetRevisionKey() const { return m_revision_key; } + HashKey GetRevisionKey() const { return m_revision_key; } Result CleanupOrphanedProfiles(auto cleanup_impl) const { /* Cleanup any orphaned profiles in our metadata. */ if (m_metadata.has_value()) { for (auto i = 0u; i < std::min(m_metadata->num_entries, util::size(m_metadata->entries)); ++i) { const auto &entry = m_metadata->entries[i]; - if (!this->IsImportingProfile(entry.identifier_0)) { - R_TRY(cleanup_impl(entry.identifier_0)); + if (!this->IsImportingProfile(entry.hash_key_0)) { + R_TRY(cleanup_impl(entry.hash_key_0)); } } } @@ -151,10 +151,10 @@ namespace ams::sprofile::srv { R_SUCCEED(); } private: - bool IsImportingProfile(Identifier profile) const { + bool IsImportingProfile(HashKey profile) const { /* Check if we're importing the desired profile. */ for (auto i = 0; i < m_importing_count; ++i) { - if (m_importing_profiles[i].identifier_0 == profile) { + if (m_importing_profiles[i].hash_key_0 == profile) { return true; } } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.cpp index 7e64a3a48..0b49dbd2f 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.cpp @@ -19,7 +19,7 @@ namespace ams::sprofile::srv { - Result ProfileImporterImpl::ImportProfile(const sprofile::srv::ProfileDataForImportData &import) { + Result ProfileImporterImpl::ImportProfile(const sprofile::srv::ProfilePayload &import) { R_RETURN(m_manager->ImportProfile(import)); } @@ -27,7 +27,7 @@ namespace ams::sprofile::srv { R_RETURN(m_manager->Commit()); } - Result ProfileImporterImpl::ImportMetadata(const sprofile::srv::ProfileMetadataForImportMetadata &import) { + Result ProfileImporterImpl::ImportMetadata(const sprofile::srv::MetadataPayload &import) { R_RETURN(m_manager->ImportMetadata(import)); } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.hpp index fce94f2b0..0f7e0d41f 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_importer_impl.hpp @@ -31,9 +31,9 @@ namespace ams::sprofile::srv { m_manager->CloseProfileImporter(); } public: - Result ImportProfile(const sprofile::srv::ProfileDataForImportData &import); + Result ImportProfile(const sprofile::srv::ProfilePayload &import); Result Commit(); - Result ImportMetadata(const sprofile::srv::ProfileMetadataForImportMetadata &import); + Result ImportMetadata(const sprofile::srv::MetadataPayload &import); }; static_assert(IsIProfileImporter); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp index 0167371ba..3e2d11e9e 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.cpp @@ -54,15 +54,15 @@ namespace ams::sprofile::srv { CreateMetadataPathImpl(dst, dst_size, mount, TemporaryDirectoryName); } - void CreateProfilePathImpl(char *dst, size_t dst_size, const char *mount, const char *dir, const Identifier &id) { + void CreateProfilePathImpl(char *dst, size_t dst_size, const char *mount, const char *dir, const HashKey &id) { SafePrint(dst, dst_size, "%s:/%s/profiles/%02x%02x%02x%02x%02x%02x%02x", mount, dir, id.data[0], id.data[1], id.data[2], id.data[3], id.data[4], id.data[5], id.data[6]); } - void CreatePrimaryProfilePath(char *dst, size_t dst_size, const char *mount, const Identifier &id) { + void CreatePrimaryProfilePath(char *dst, size_t dst_size, const char *mount, const HashKey &id) { CreateProfilePathImpl(dst, dst_size, mount, PrimaryDirectoryName, id); } - void CreateTemporaryProfilePath(char *dst, size_t dst_size, const char *mount, const Identifier &id) { + void CreateTemporaryProfilePath(char *dst, size_t dst_size, const char *mount, const HashKey &id) { CreateProfilePathImpl(dst, dst_size, mount, TemporaryDirectoryName, id); } @@ -185,7 +185,12 @@ namespace ams::sprofile::srv { this->CloseProfileImporterImpl(); } - Result ProfileManager::ImportProfile(const sprofile::srv::ProfileDataForImportData &import) { + Result ProfileManager::ImportProfile(const sprofile::srv::ProfilePayload &import) { + /* On 23.0.0+ profile importing is no longer supported. */ + if (hos::GetVersion() >= hos::Version_23_0_0) { + R_THROW(sprofile::ResultNotImplemented()); + } + /* Acquire locks. */ std::scoped_lock lk1(m_profile_importer_mutex); std::scoped_lock lk2(m_fs_mutex); @@ -211,21 +216,21 @@ namespace ams::sprofile::srv { } /* Succeed if we already have the profile. */ - R_SUCCEED_IF(m_profile_importer->HasProfile(import.header.identifier_0, import.header.identifier_1)); + R_SUCCEED_IF(m_profile_importer->HasProfile(import.header.hash_key_0, import.header.hash_key_1)); /* Check that we're importing the profile. */ - R_UNLESS(m_profile_importer->CanImportProfile(import.header.identifier_0), sprofile::ResultInvalidState()); + R_UNLESS(m_profile_importer->CanImportProfile(import.header.hash_key_0), sprofile::ResultInvalidState()); /* Create temporary directories. */ R_TRY(this->EnsureTemporaryDirectories()); /* Create profile. */ char path[0x30]; - CreateTemporaryProfilePath(path, sizeof(path), m_save_data_info.mount_name, import.header.identifier_0); + CreateTemporaryProfilePath(path, sizeof(path), m_save_data_info.mount_name, import.header.hash_key_0); R_TRY(WriteFile(path, std::addressof(import.data), sizeof(import.data))); /* Set profile imported. */ - m_profile_importer->OnImportProfile(import.header.identifier_0); + m_profile_importer->OnImportProfile(import.header.hash_key_0); R_SUCCEED(); } @@ -266,7 +271,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::ImportMetadata(const sprofile::srv::ProfileMetadataForImportMetadata &import) { + Result ProfileManager::ImportMetadata(const sprofile::srv::MetadataPayload &import) { /* Acquire locks. */ std::scoped_lock lk1(m_profile_importer_mutex); std::scoped_lock lk2(m_fs_mutex); @@ -340,7 +345,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::LoadProfile(Identifier profile) { + Result ProfileManager::LoadProfile(HashKey profile) { /* Check if we already have the profile. */ if (m_service_profile.has_value()) { R_SUCCEED_IF(m_service_profile->name == profile); @@ -362,7 +367,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetDataEntry(ProfileDataEntry *out, Identifier profile, Identifier key) { + Result ProfileManager::GetDataEntry(ProfileDataEntry *out, HashKey profile, HashKey key) { /* Acquire locks. */ std::scoped_lock lk1(m_service_profile_mutex); std::scoped_lock lk2(m_general_mutex); @@ -381,7 +386,7 @@ namespace ams::sprofile::srv { R_THROW(sprofile::ResultKeyNotFound()); } - Result ProfileManager::GetSigned64(s64 *out, Identifier profile, Identifier key) { + Result ProfileManager::GetInt64Value(s64 *out, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -394,7 +399,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetUnsigned64(u64 *out, Identifier profile, Identifier key) { + Result ProfileManager::GetUInt64Value(u64 *out, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -407,7 +412,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetSigned32(s32 *out, Identifier profile, Identifier key) { + Result ProfileManager::GetInt32Value(s32 *out, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -420,7 +425,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetUnsigned32(u32 *out, Identifier profile, Identifier key) { + Result ProfileManager::GetUInt32Value(u32 *out, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -433,7 +438,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetByte(u8 *out, Identifier profile, Identifier key) { + Result ProfileManager::GetBooleanValue(u8 *out, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -446,7 +451,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ProfileManager::GetRaw(u8 *out_type, u64 *out_value, Identifier profile, Identifier key) { + Result ProfileManager::QueryValue(u8 *out_type, u64 *out_value, HashKey profile, HashKey key) { /* Get the data entry. */ ProfileDataEntry entry; R_TRY(this->GetDataEntry(std::addressof(entry), profile, key)); @@ -477,8 +482,8 @@ namespace ams::sprofile::srv { const auto &profile = m_profile_importer->GetImportingProfile(i); if (profile.is_new_import) { - CreateTemporaryProfilePath(tmp_path, sizeof(tmp_path), m_save_data_info.mount_name, profile.identifier_0); - CreatePrimaryProfilePath(pri_path, sizeof(pri_path), m_save_data_info.mount_name, profile.identifier_0); + CreateTemporaryProfilePath(tmp_path, sizeof(tmp_path), m_save_data_info.mount_name, profile.hash_key_0); + CreatePrimaryProfilePath(pri_path, sizeof(pri_path), m_save_data_info.mount_name, profile.hash_key_0); R_TRY(MoveFile(tmp_path, pri_path)); } } @@ -494,7 +499,7 @@ namespace ams::sprofile::srv { char pri_path[0x30]; /* Cleanup the profiles. */ - R_RETURN(m_profile_importer->CleanupOrphanedProfiles([&](Identifier profile) ALWAYS_INLINE_LAMBDA -> Result { + R_RETURN(m_profile_importer->CleanupOrphanedProfiles([&](HashKey profile) ALWAYS_INLINE_LAMBDA -> Result { CreatePrimaryProfilePath(pri_path, sizeof(pri_path), m_save_data_info.mount_name, profile); R_RETURN(DeleteFile(pri_path)); })); @@ -506,7 +511,7 @@ namespace ams::sprofile::srv { /* If we need to, invalidate the loaded service profile. */ if (m_service_profile.has_value()) { for (auto i = 0; i < m_profile_importer->GetImportingCount(); ++i) { - if (m_service_profile->name == m_profile_importer->GetImportingProfile(i).identifier_0) { + if (m_service_profile->name == m_profile_importer->GetImportingProfile(i).hash_key_0) { m_service_profile = util::nullopt; break; } @@ -521,7 +526,7 @@ namespace ams::sprofile::srv { const auto &profile = m_profile_importer->GetImportingProfile(i); if (profile.is_new_import) { - m_update_observer_manager.OnUpdate(profile.identifier_0); + m_update_observer_manager.OnUpdate(profile.hash_key_0); } } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.hpp index 40484b998..6154a73fd 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_manager.hpp @@ -52,19 +52,19 @@ namespace ams::sprofile::srv { Result OpenProfileImporter(); void CloseProfileImporter(); - Result ImportProfile(const sprofile::srv::ProfileDataForImportData &data); + Result ImportProfile(const sprofile::srv::ProfilePayload &data); Result Commit(); - Result ImportMetadata(const sprofile::srv::ProfileMetadataForImportMetadata &data); + Result ImportMetadata(const sprofile::srv::MetadataPayload &data); Result LoadPrimaryMetadata(ProfileMetadata *out); - Result GetSigned64(s64 *out, Identifier profile, Identifier key); - Result GetUnsigned64(u64 *out, Identifier profile, Identifier key); - Result GetSigned32(s32 *out, Identifier profile, Identifier key); - Result GetUnsigned32(u32 *out, Identifier profile, Identifier key); - Result GetByte(u8 *out, Identifier profile, Identifier key); + Result GetInt64Value(s64 *out, HashKey profile, HashKey key); + Result GetUInt64Value(u64 *out, HashKey profile, HashKey key); + Result GetInt32Value(s32 *out, HashKey profile, HashKey key); + Result GetUInt32Value(u32 *out, HashKey profile, HashKey key); + Result GetBooleanValue(u8 *out, HashKey profile, HashKey key); - Result GetRaw(u8 *out_type, u64 *out_value, Identifier profile, Identifier key); + Result QueryValue(u8 *out_type, u64 *out_value, HashKey profile, HashKey key); ProfileUpdateObserverManager &GetUpdateObserverManager() { return m_update_observer_manager; } private: @@ -76,9 +76,9 @@ namespace ams::sprofile::srv { void OnCommitted(); - Result GetDataEntry(ProfileDataEntry *out, Identifier profile, Identifier key); + Result GetDataEntry(ProfileDataEntry *out, HashKey profile, HashKey key); - Result LoadProfile(Identifier profile); + Result LoadProfile(HashKey profile); Result EnsurePrimaryDirectories(); Result EnsureTemporaryDirectories(); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.cpp index b601764af..d2a981bd4 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.cpp @@ -19,24 +19,72 @@ namespace ams::sprofile::srv { - Result ProfileReaderImpl::GetSigned64(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetSigned64(out.GetPointer(), profile, key)); + Result ProfileReaderImpl::GetInt64Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->GetInt64Value(out.GetPointer(), profile, key)); } - Result ProfileReaderImpl::GetUnsigned64(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetUnsigned64(out.GetPointer(), profile, key)); + Result ProfileReaderImpl::GetUInt64Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->GetUInt64Value(out.GetPointer(), profile, key)); } - Result ProfileReaderImpl::GetSigned32(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetSigned32(out.GetPointer(), profile, key)); + Result ProfileReaderImpl::GetInt32Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->GetInt32Value(out.GetPointer(), profile, key)); } - Result ProfileReaderImpl::GetUnsigned32(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetUnsigned32(out.GetPointer(), profile, key)); + Result ProfileReaderImpl::GetUInt32Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->GetUInt32Value(out.GetPointer(), profile, key)); } - Result ProfileReaderImpl::GetByte(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key) { - R_RETURN(m_manager->GetByte(out.GetPointer(), profile, key)); + Result ProfileReaderImpl::GetBooleanValue(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + R_RETURN(m_manager->GetBooleanValue(out.GetPointer(), profile, key)); + } + + Result ProfileReaderImpl::GetAnyValue(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetInt8ValueArray(sf::Out out, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetInt64ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetUInt64ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetInt32ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetUInt32ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetUInt8ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); + } + + Result ProfileReaderImpl::GetAnyValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key) { + /* On 23.0.0+ this isn't reachable from HIPC. */ + AMS_UNUSED(out, out_buffer, profile, key); + R_SUCCEED(); } } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.hpp index 4768538e4..2f193cd80 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_reader_impl.hpp @@ -27,11 +27,19 @@ namespace ams::sprofile::srv { public: ProfileReaderImpl(ProfileManager *manager) : m_manager(manager) { /* ... */ } public: - Result GetSigned64(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key); - Result GetUnsigned64(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key); - Result GetSigned32(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key); - Result GetUnsigned32(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key); - Result GetByte(sf::Out out, sprofile::Identifier profile, sprofile::Identifier key); + Result GetInt64Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetUInt64Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetInt32Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetUInt32Value(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetBooleanValue(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetAnyValue(sf::Out out, sprofile::HashKey profile, sprofile::HashKey key); + Result GetInt8ValueArray(sf::Out out, const sf::OutBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetInt64ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetUInt64ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetInt32ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetUInt32ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetUInt8ValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); + Result GetAnyValueArray(sf::Out out, const sf::OutPointerBuffer &out_buffer, sprofile::HashKey profile, sprofile::HashKey key); }; static_assert(IsIProfileReader); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp index f54d230d4..b7c8dbee7 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_profile_update_observer_impl.hpp @@ -24,7 +24,7 @@ namespace ams::sprofile::srv { static constexpr auto MaxProfiles = 4; private: os::SystemEvent m_event; - Identifier m_profiles[MaxProfiles]; + HashKey m_profiles[MaxProfiles]; int m_profile_count; os::SdkMutex m_mutex; public: @@ -34,7 +34,7 @@ namespace ams::sprofile::srv { os::SystemEvent &GetEvent() { return m_event; } const os::SystemEvent &GetEvent() const { return m_event; } public: - Result Listen(Identifier profile) { + Result Subscribe(HashKey profile) { /* Lock ourselves. */ std::scoped_lock lk(m_mutex); @@ -51,7 +51,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result Unlisten(Identifier profile) { + Result Unsubscribe(HashKey profile) { /* Check that we're listening. */ for (auto i = 0; i < m_profile_count; ++i) { if (m_profiles[i] == profile) { @@ -64,12 +64,12 @@ namespace ams::sprofile::srv { R_THROW(sprofile::ResultNotListening()); } - Result GetEventHandle(sf::OutCopyHandle out) { + Result GetUpdateEventNativeHandle(sf::OutCopyHandle out) { out.SetValue(m_event.GetReadableHandle(), false); R_SUCCEED(); } public: - void OnUpdate(Identifier profile) { + void OnUpdate(HashKey profile) { for (auto i = 0; i < m_profile_count; ++i) { if (m_profiles[i] == profile) { m_event.Signal(); @@ -93,7 +93,7 @@ namespace ams::sprofile::srv { Result OpenObserver(sf::Out> &out, MemoryResource *memory_resource); void CloseObserver(ProfileUpdateObserverImpl *observer); - void OnUpdate(Identifier profile) { + void OnUpdate(HashKey profile) { std::scoped_lock lk(m_mutex); for (auto i = 0; i < m_observer_count; ++i) { diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp index c8e4e5036..43f3ed9af 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.cpp @@ -34,7 +34,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ServiceForBgAgent::GetImportableProfileUrls(sf::Out out_count, const sf::OutArray &out, const sprofile::srv::ProfileMetadataForImportMetadata &arg) { + Result ServiceForBgAgent::GetProfileDownloadUrlList(sf::Out out_count, const sf::OutArray &out, const sprofile::srv::MetadataPayload &arg) { /* Check size. */ R_UNLESS(out.GetSize() >= arg.metadata.num_entries, sprofile::ResultInvalidArgument()); @@ -57,7 +57,7 @@ namespace ams::sprofile::srv { for (u32 j = 0; j < primary_metadata.num_entries; ++j) { const auto &pri_entry = primary_metadata.entries[j]; - if (pri_entry.identifier_0 == arg_entry.identifier_0 && pri_entry.identifier_1 == arg_entry.identifier_1) { + if (pri_entry.hash_key_0 == arg_entry.hash_key_0 && pri_entry.hash_key_1 == arg_entry.hash_key_1) { have_entry = true; break; } @@ -75,7 +75,7 @@ namespace ams::sprofile::srv { } - Result ServiceForBgAgent::IsUpdateNeeded(sf::Out out, Identifier revision_key) { + Result ServiceForBgAgent::GetMetadataNewness(sf::Out out, HashKey revision_key) { /* Load primary metadata. */ bool loaded_metadata = true; sprofile::srv::ProfileMetadata primary_metadata; @@ -91,7 +91,7 @@ namespace ams::sprofile::srv { R_SUCCEED(); } - Result ServiceForBgAgent::Reset() { + Result ServiceForBgAgent::ClearSaveDataForTest() { R_RETURN(m_profile_manager->ResetSaveData()); } diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.hpp index 43d308966..66416fd1a 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_service_for_bg_agent.hpp @@ -29,9 +29,9 @@ namespace ams::sprofile::srv { constexpr ServiceForBgAgent(MemoryResource *mr, ProfileManager *pm) : m_memory_resource(mr), m_profile_manager(pm) { /* ... */ } public: Result OpenProfileImporter(sf::Out> out); - Result GetImportableProfileUrls(sf::Out out_count, const sf::OutArray &out, const sprofile::srv::ProfileMetadataForImportMetadata &arg); - Result IsUpdateNeeded(sf::Out out, Identifier revision_key); - Result Reset(); + Result GetProfileDownloadUrlList(sf::Out out_count, const sf::OutArray &out, const sprofile::srv::MetadataPayload &arg); + Result GetMetadataNewness(sf::Out out, HashKey revision_key); + Result ClearSaveDataForTest(); }; static_assert(sprofile::srv::IsISprofileServiceForBgAgent); diff --git a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_types.hpp b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_types.hpp index d20610a17..ddddaa26e 100644 --- a/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_types.hpp +++ b/libraries/libstratosphere/source/sprofile/srv/sprofile_srv_types.hpp @@ -33,7 +33,7 @@ namespace ams::sprofile::srv { }; struct ProfileDataEntry { - Identifier key; + HashKey key; ValueType type; union { s64 value_s64; @@ -65,7 +65,7 @@ namespace ams::sprofile::srv { static_assert(AMS_OFFSETOF(ProfileData, entries) == 0x30); struct ServiceProfile { - Identifier name; + HashKey name; ProfileData data; }; static_assert(util::is_pod::value); @@ -74,10 +74,10 @@ namespace ams::sprofile::srv { static_assert(AMS_OFFSETOF(ServiceProfile, name) == 0x00); static_assert(AMS_OFFSETOF(ServiceProfile, data) == 0x08); - struct ProfileDataForImportData : public sf::LargeData, public sf::PrefersMapAliasTransferMode { + struct ProfilePayload : public sf::LargeData, public sf::PrefersMapAliasTransferMode { struct { - Identifier identifier_0; - Identifier identifier_1; + HashKey hash_key_0; + HashKey hash_key_1; u8 unk_0E[2]; u32 version; u8 unk_14[0x1C]; @@ -86,25 +86,25 @@ namespace ams::sprofile::srv { ProfileData data; u8 unk_4040[0x4400 - 0x4040]; }; - static_assert(util::is_pod::value); - static_assert(sizeof(ProfileDataForImportData) == 0x4400); + static_assert(util::is_pod::value); + static_assert(sizeof(ProfilePayload) == 0x4400); - static_assert(AMS_OFFSETOF(ProfileDataForImportData, header) == 0x00); - static_assert(AMS_OFFSETOF(ProfileDataForImportData, hash) == 0x30); - static_assert(AMS_OFFSETOF(ProfileDataForImportData, data) == 0x40); - static_assert(AMS_OFFSETOF(ProfileDataForImportData, unk_4040) == 0x4040); + static_assert(AMS_OFFSETOF(ProfilePayload, header) == 0x00); + static_assert(AMS_OFFSETOF(ProfilePayload, hash) == 0x30); + static_assert(AMS_OFFSETOF(ProfilePayload, data) == 0x40); + static_assert(AMS_OFFSETOF(ProfilePayload, unk_4040) == 0x4040); struct ProfileMetadataEntry { - Identifier identifier_0; - Identifier identifier_1; + HashKey hash_key_0; + HashKey hash_key_1; u8 unk_0E[0x32]; }; static_assert(util::is_pod::value); static_assert(sizeof(ProfileMetadataEntry) == 0x40); - static_assert(AMS_OFFSETOF(ProfileMetadataEntry, identifier_0) == 0x00); - static_assert(AMS_OFFSETOF(ProfileMetadataEntry, identifier_1) == 0x07); - static_assert(AMS_OFFSETOF(ProfileMetadataEntry, unk_0E) == 0x0E); + static_assert(AMS_OFFSETOF(ProfileMetadataEntry, hash_key_0) == 0x00); + static_assert(AMS_OFFSETOF(ProfileMetadataEntry, hash_key_1) == 0x07); + static_assert(AMS_OFFSETOF(ProfileMetadataEntry, unk_0E) == 0x0E); struct ProfileUrl : public sf::PrefersMapAliasTransferMode { char url[0x100]; @@ -115,7 +115,7 @@ namespace ams::sprofile::srv { struct ProfileMetadata { u32 num_entries; u32 unk_04; - Identifier revision_key; + HashKey revision_key; u8 unk_0F[0x1]; u8 unk_10[0x30]; ProfileMetadataEntry entries[50]; @@ -130,7 +130,7 @@ namespace ams::sprofile::srv { static_assert(AMS_OFFSETOF(ProfileMetadata, unk_10) == 0x10); static_assert(AMS_OFFSETOF(ProfileMetadata, entries) == 0x40); - struct ProfileMetadataForImportMetadata : public sf::LargeData, public sf::PrefersMapAliasTransferMode { + struct MetadataPayload : public sf::LargeData, public sf::PrefersMapAliasTransferMode { struct { u32 version; u8 unk_04[0x1C]; @@ -140,13 +140,13 @@ namespace ams::sprofile::srv { ProfileUrl profile_urls[50]; u8 unk_3EF0[0x8000 - 0x3EF0]; }; - static_assert(util::is_pod::value); - static_assert(sizeof(ProfileMetadataForImportMetadata) == 0x8000); + static_assert(util::is_pod::value); + static_assert(sizeof(MetadataPayload) == 0x8000); - static_assert(AMS_OFFSETOF(ProfileMetadataForImportMetadata, header) == 0x00); - static_assert(AMS_OFFSETOF(ProfileMetadataForImportMetadata, hash) == 0x20); - static_assert(AMS_OFFSETOF(ProfileMetadataForImportMetadata, metadata) == 0x30); - static_assert(AMS_OFFSETOF(ProfileMetadataForImportMetadata, profile_urls) == 0xCF0); - static_assert(AMS_OFFSETOF(ProfileMetadataForImportMetadata, unk_3EF0) == 0x3EF0); + static_assert(AMS_OFFSETOF(MetadataPayload, header) == 0x00); + static_assert(AMS_OFFSETOF(MetadataPayload, hash) == 0x20); + static_assert(AMS_OFFSETOF(MetadataPayload, metadata) == 0x30); + static_assert(AMS_OFFSETOF(MetadataPayload, profile_urls) == 0xCF0); + static_assert(AMS_OFFSETOF(MetadataPayload, unk_3EF0) == 0x3EF0); } diff --git a/libraries/libvapours/include/vapours/results/sprofile_results.hpp b/libraries/libvapours/include/vapours/results/sprofile_results.hpp index 4000bd8f1..78168028e 100644 --- a/libraries/libvapours/include/vapours/results/sprofile_results.hpp +++ b/libraries/libvapours/include/vapours/results/sprofile_results.hpp @@ -21,20 +21,23 @@ R_DEFINE_NAMESPACE_RESULT_MODULE(ams::sprofile, 246); namespace ams::sprofile { - R_DEFINE_ERROR_RESULT(InvalidArgument, 100); - R_DEFINE_ERROR_RESULT(InvalidState, 101); + R_DEFINE_ERROR_RESULT(InvalidArgument, 100); + R_DEFINE_ERROR_RESULT(InvalidState, 101); + + R_DEFINE_ERROR_RESULT(NotImplemented, 300); + R_DEFINE_ERROR_RESULT(NotSupported, 301); + R_DEFINE_ERROR_RESULT(Delayed, 302); + R_DEFINE_ERROR_RESULT(NotPermitted, 303); - R_DEFINE_ERROR_RESULT(NotPermitted, 303); + R_DEFINE_ERROR_RESULT(AllocationFailed, 401); - R_DEFINE_ERROR_RESULT(AllocationFailed, 401); + R_DEFINE_ERROR_RESULT(KeyNotFound, 600); + R_DEFINE_ERROR_RESULT(InvalidDataType, 601); - R_DEFINE_ERROR_RESULT(KeyNotFound, 600); - R_DEFINE_ERROR_RESULT(InvalidDataType, 601); - - R_DEFINE_ERROR_RESULT(MaxListeners, 620); - R_DEFINE_ERROR_RESULT(AlreadyListening, 621); - R_DEFINE_ERROR_RESULT(NotListening, 622); - R_DEFINE_ERROR_RESULT(MaxObservers, 623); + R_DEFINE_ERROR_RESULT(MaxListeners, 620); + R_DEFINE_ERROR_RESULT(AlreadyListening, 621); + R_DEFINE_ERROR_RESULT(NotListening, 622); + R_DEFINE_ERROR_RESULT(MaxObservers, 623); R_DEFINE_ERROR_RESULT(InvalidMetadataVersion, 3210); R_DEFINE_ERROR_RESULT(InvalidMetadataHash, 3211);