From 5135b74179e99507cc5eee374e76c3f0ac3ee717 Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 14 Dec 2019 01:01:48 -0500 Subject: core: Initialize several structs that make use of Common::UUID. --- src/core/hle/service/acc/acc.cpp | 2 +- src/core/hle/service/acc/profile_manager.cpp | 14 +++++++------- src/core/hle/service/acc/profile_manager.h | 27 ++++++++++++++------------- 3 files changed, 22 insertions(+), 21 deletions(-) (limited to 'src/core/hle/service/acc') diff --git a/src/core/hle/service/acc/acc.cpp b/src/core/hle/service/acc/acc.cpp index 7e3e311fb..cfac8ca9a 100644 --- a/src/core/hle/service/acc/acc.cpp +++ b/src/core/hle/service/acc/acc.cpp @@ -211,7 +211,7 @@ protected: } ProfileManager& profile_manager; - Common::UUID user_id; ///< The user id this profile refers to. + Common::UUID user_id{Common::INVALID_UUID}; ///< The user id this profile refers to. }; class IProfile final : public IProfileCommon { diff --git a/src/core/hle/service/acc/profile_manager.cpp b/src/core/hle/service/acc/profile_manager.cpp index 3e756e59e..eb8c81645 100644 --- a/src/core/hle/service/acc/profile_manager.cpp +++ b/src/core/hle/service/acc/profile_manager.cpp @@ -16,17 +16,17 @@ namespace Service::Account { using Common::UUID; struct UserRaw { - UUID uuid; - UUID uuid2; - u64 timestamp; - ProfileUsername username; - ProfileData extra_data; + UUID uuid{Common::INVALID_UUID}; + UUID uuid2{Common::INVALID_UUID}; + u64 timestamp{}; + ProfileUsername username{}; + ProfileData extra_data{}; }; static_assert(sizeof(UserRaw) == 0xC8, "UserRaw has incorrect size."); struct ProfileDataRaw { INSERT_PADDING_BYTES(0x10); - std::array users; + std::array users{}; }; static_assert(sizeof(ProfileDataRaw) == 0x650, "ProfileDataRaw has incorrect size."); @@ -238,7 +238,7 @@ UserIDArray ProfileManager::GetOpenUsers() const { std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) { if (p.is_open) return p.user_uuid; - return UUID{}; + return UUID{Common::INVALID_UUID}; }); std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; }); return output; diff --git a/src/core/hle/service/acc/profile_manager.h b/src/core/hle/service/acc/profile_manager.h index 5a6d28925..5310637a6 100644 --- a/src/core/hle/service/acc/profile_manager.h +++ b/src/core/hle/service/acc/profile_manager.h @@ -13,9 +13,10 @@ #include "core/hle/result.h" namespace Service::Account { -constexpr std::size_t MAX_USERS = 8; -constexpr std::size_t profile_username_size = 32; +constexpr std::size_t MAX_USERS{8}; +constexpr std::size_t profile_username_size{32}; + using ProfileUsername = std::array; using UserIDArray = std::array; @@ -23,8 +24,8 @@ using UserIDArray = std::array; /// TODO: RE this structure struct ProfileData { INSERT_PADDING_WORDS(1); - u32 icon_id; - u8 bg_color_id; + u32 icon_id{}; + u8 bg_color_id{}; INSERT_PADDING_BYTES(0x7); INSERT_PADDING_BYTES(0x10); INSERT_PADDING_BYTES(0x60); @@ -34,17 +35,17 @@ static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect /// This holds general information about a users profile. This is where we store all the information /// based on a specific user struct ProfileInfo { - Common::UUID user_uuid; - ProfileUsername username; - u64 creation_time; - ProfileData data; // TODO(ognik): Work out what this is - bool is_open; + Common::UUID user_uuid{Common::INVALID_UUID}; + ProfileUsername username{}; + u64 creation_time{}; + ProfileData data{}; // TODO(ognik): Work out what this is + bool is_open{}; }; struct ProfileBase { - Common::UUID user_uuid; - u64_le timestamp; - ProfileUsername username; + Common::UUID user_uuid{Common::INVALID_UUID}; + u64_le timestamp{}; + ProfileUsername username{}; // Zero out all the fields to make the profile slot considered "Empty" void Invalidate() { @@ -101,7 +102,7 @@ private: bool RemoveProfileAtIndex(std::size_t index); std::array profiles{}; - std::size_t user_count = 0; + std::size_t user_count{}; Common::UUID last_opened_user{Common::INVALID_UUID}; }; -- cgit v1.2.3