summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/acc/acc.cpp2
-rw-r--r--src/core/hle/service/acc/profile_manager.cpp14
-rw-r--r--src/core/hle/service/acc/profile_manager.h27
-rw-r--r--src/core/hle/service/friend/friend.cpp2
-rw-r--r--src/core/hle/service/mii/mii_manager.h156
5 files changed, 101 insertions, 100 deletions
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:
211 } 211 }
212 212
213 ProfileManager& profile_manager; 213 ProfileManager& profile_manager;
214 Common::UUID user_id; ///< The user id this profile refers to. 214 Common::UUID user_id{Common::INVALID_UUID}; ///< The user id this profile refers to.
215}; 215};
216 216
217class IProfile final : public IProfileCommon { 217class 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 {
16using Common::UUID; 16using Common::UUID;
17 17
18struct UserRaw { 18struct UserRaw {
19 UUID uuid; 19 UUID uuid{Common::INVALID_UUID};
20 UUID uuid2; 20 UUID uuid2{Common::INVALID_UUID};
21 u64 timestamp; 21 u64 timestamp{};
22 ProfileUsername username; 22 ProfileUsername username{};
23 ProfileData extra_data; 23 ProfileData extra_data{};
24}; 24};
25static_assert(sizeof(UserRaw) == 0xC8, "UserRaw has incorrect size."); 25static_assert(sizeof(UserRaw) == 0xC8, "UserRaw has incorrect size.");
26 26
27struct ProfileDataRaw { 27struct ProfileDataRaw {
28 INSERT_PADDING_BYTES(0x10); 28 INSERT_PADDING_BYTES(0x10);
29 std::array<UserRaw, MAX_USERS> users; 29 std::array<UserRaw, MAX_USERS> users{};
30}; 30};
31static_assert(sizeof(ProfileDataRaw) == 0x650, "ProfileDataRaw has incorrect size."); 31static_assert(sizeof(ProfileDataRaw) == 0x650, "ProfileDataRaw has incorrect size.");
32 32
@@ -238,7 +238,7 @@ UserIDArray ProfileManager::GetOpenUsers() const {
238 std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) { 238 std::transform(profiles.begin(), profiles.end(), output.begin(), [](const ProfileInfo& p) {
239 if (p.is_open) 239 if (p.is_open)
240 return p.user_uuid; 240 return p.user_uuid;
241 return UUID{}; 241 return UUID{Common::INVALID_UUID};
242 }); 242 });
243 std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; }); 243 std::stable_partition(output.begin(), output.end(), [](const UUID& uuid) { return uuid; });
244 return output; 244 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 @@
13#include "core/hle/result.h" 13#include "core/hle/result.h"
14 14
15namespace Service::Account { 15namespace Service::Account {
16constexpr std::size_t MAX_USERS = 8;
17 16
18constexpr std::size_t profile_username_size = 32; 17constexpr std::size_t MAX_USERS{8};
18constexpr std::size_t profile_username_size{32};
19
19using ProfileUsername = std::array<u8, profile_username_size>; 20using ProfileUsername = std::array<u8, profile_username_size>;
20using UserIDArray = std::array<Common::UUID, MAX_USERS>; 21using UserIDArray = std::array<Common::UUID, MAX_USERS>;
21 22
@@ -23,8 +24,8 @@ using UserIDArray = std::array<Common::UUID, MAX_USERS>;
23/// TODO: RE this structure 24/// TODO: RE this structure
24struct ProfileData { 25struct ProfileData {
25 INSERT_PADDING_WORDS(1); 26 INSERT_PADDING_WORDS(1);
26 u32 icon_id; 27 u32 icon_id{};
27 u8 bg_color_id; 28 u8 bg_color_id{};
28 INSERT_PADDING_BYTES(0x7); 29 INSERT_PADDING_BYTES(0x7);
29 INSERT_PADDING_BYTES(0x10); 30 INSERT_PADDING_BYTES(0x10);
30 INSERT_PADDING_BYTES(0x60); 31 INSERT_PADDING_BYTES(0x60);
@@ -34,17 +35,17 @@ static_assert(sizeof(ProfileData) == 0x80, "ProfileData structure has incorrect
34/// This holds general information about a users profile. This is where we store all the information 35/// This holds general information about a users profile. This is where we store all the information
35/// based on a specific user 36/// based on a specific user
36struct ProfileInfo { 37struct ProfileInfo {
37 Common::UUID user_uuid; 38 Common::UUID user_uuid{Common::INVALID_UUID};
38 ProfileUsername username; 39 ProfileUsername username{};
39 u64 creation_time; 40 u64 creation_time{};
40 ProfileData data; // TODO(ognik): Work out what this is 41 ProfileData data{}; // TODO(ognik): Work out what this is
41 bool is_open; 42 bool is_open{};
42}; 43};
43 44
44struct ProfileBase { 45struct ProfileBase {
45 Common::UUID user_uuid; 46 Common::UUID user_uuid{Common::INVALID_UUID};
46 u64_le timestamp; 47 u64_le timestamp{};
47 ProfileUsername username; 48 ProfileUsername username{};
48 49
49 // Zero out all the fields to make the profile slot considered "Empty" 50 // Zero out all the fields to make the profile slot considered "Empty"
50 void Invalidate() { 51 void Invalidate() {
@@ -101,7 +102,7 @@ private:
101 bool RemoveProfileAtIndex(std::size_t index); 102 bool RemoveProfileAtIndex(std::size_t index);
102 103
103 std::array<ProfileInfo, MAX_USERS> profiles{}; 104 std::array<ProfileInfo, MAX_USERS> profiles{};
104 std::size_t user_count = 0; 105 std::size_t user_count{};
105 Common::UUID last_opened_user{Common::INVALID_UUID}; 106 Common::UUID last_opened_user{Common::INVALID_UUID};
106}; 107};
107 108
diff --git a/src/core/hle/service/friend/friend.cpp b/src/core/hle/service/friend/friend.cpp
index 219176c31..6aadb3ea8 100644
--- a/src/core/hle/service/friend/friend.cpp
+++ b/src/core/hle/service/friend/friend.cpp
@@ -241,7 +241,7 @@ private:
241 bool has_received_friend_request; 241 bool has_received_friend_request;
242 }; 242 };
243 243
244 Common::UUID uuid; 244 Common::UUID uuid{Common::INVALID_UUID};
245 Kernel::EventPair notification_event; 245 Kernel::EventPair notification_event;
246 std::queue<SizedNotificationInfo> notifications; 246 std::queue<SizedNotificationInfo> notifications;
247 States states{}; 247 States states{};
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h
index 38ad78a0d..fc742816a 100644
--- a/src/core/hle/service/mii/mii_manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
@@ -10,13 +10,13 @@
10 10
11namespace Service::Mii { 11namespace Service::Mii {
12 12
13constexpr std::size_t MAX_MIIS = 100; 13constexpr std::size_t MAX_MIIS{100};
14constexpr u32 INVALID_INDEX = 0xFFFFFFFF; 14constexpr u32 INVALID_INDEX{0xFFFFFFFF};
15 15
16struct RandomParameters { 16struct RandomParameters {
17 u32 unknown_1; 17 u32 unknown_1{};
18 u32 unknown_2; 18 u32 unknown_2{};
19 u32 unknown_3; 19 u32 unknown_3{};
20}; 20};
21static_assert(sizeof(RandomParameters) == 0xC, "RandomParameters has incorrect size."); 21static_assert(sizeof(RandomParameters) == 0xC, "RandomParameters has incorrect size.");
22 22
@@ -30,57 +30,57 @@ enum class Source : u32 {
30std::ostream& operator<<(std::ostream& os, Source source); 30std::ostream& operator<<(std::ostream& os, Source source);
31 31
32struct MiiInfo { 32struct MiiInfo {
33 Common::UUID uuid; 33 Common::UUID uuid{Common::INVALID_UUID};
34 std::array<char16_t, 11> name; 34 std::array<char16_t, 11> name{};
35 u8 font_region; 35 u8 font_region{};
36 u8 favorite_color; 36 u8 favorite_color{};
37 u8 gender; 37 u8 gender{};
38 u8 height; 38 u8 height{};
39 u8 weight; 39 u8 weight{};
40 u8 mii_type; 40 u8 mii_type{};
41 u8 mii_region; 41 u8 mii_region{};
42 u8 face_type; 42 u8 face_type{};
43 u8 face_color; 43 u8 face_color{};
44 u8 face_wrinkle; 44 u8 face_wrinkle{};
45 u8 face_makeup; 45 u8 face_makeup{};
46 u8 hair_type; 46 u8 hair_type{};
47 u8 hair_color; 47 u8 hair_color{};
48 bool hair_flip; 48 bool hair_flip{};
49 u8 eye_type; 49 u8 eye_type{};
50 u8 eye_color; 50 u8 eye_color{};
51 u8 eye_scale; 51 u8 eye_scale{};
52 u8 eye_aspect_ratio; 52 u8 eye_aspect_ratio{};
53 u8 eye_rotate; 53 u8 eye_rotate{};
54 u8 eye_x; 54 u8 eye_x{};
55 u8 eye_y; 55 u8 eye_y{};
56 u8 eyebrow_type; 56 u8 eyebrow_type{};
57 u8 eyebrow_color; 57 u8 eyebrow_color{};
58 u8 eyebrow_scale; 58 u8 eyebrow_scale{};
59 u8 eyebrow_aspect_ratio; 59 u8 eyebrow_aspect_ratio{};
60 u8 eyebrow_rotate; 60 u8 eyebrow_rotate{};
61 u8 eyebrow_x; 61 u8 eyebrow_x{};
62 u8 eyebrow_y; 62 u8 eyebrow_y{};
63 u8 nose_type; 63 u8 nose_type{};
64 u8 nose_scale; 64 u8 nose_scale{};
65 u8 nose_y; 65 u8 nose_y{};
66 u8 mouth_type; 66 u8 mouth_type{};
67 u8 mouth_color; 67 u8 mouth_color{};
68 u8 mouth_scale; 68 u8 mouth_scale{};
69 u8 mouth_aspect_ratio; 69 u8 mouth_aspect_ratio{};
70 u8 mouth_y; 70 u8 mouth_y{};
71 u8 facial_hair_color; 71 u8 facial_hair_color{};
72 u8 beard_type; 72 u8 beard_type{};
73 u8 mustache_type; 73 u8 mustache_type{};
74 u8 mustache_scale; 74 u8 mustache_scale{};
75 u8 mustache_y; 75 u8 mustache_y{};
76 u8 glasses_type; 76 u8 glasses_type{};
77 u8 glasses_color; 77 u8 glasses_color{};
78 u8 glasses_scale; 78 u8 glasses_scale{};
79 u8 glasses_y; 79 u8 glasses_y{};
80 u8 mole_type; 80 u8 mole_type{};
81 u8 mole_scale; 81 u8 mole_scale{};
82 u8 mole_x; 82 u8 mole_x{};
83 u8 mole_y; 83 u8 mole_y{};
84 INSERT_PADDING_BYTES(1); 84 INSERT_PADDING_BYTES(1);
85 85
86 std::u16string Name() const; 86 std::u16string Name() const;
@@ -94,14 +94,14 @@ bool operator!=(const MiiInfo& lhs, const MiiInfo& rhs);
94 94
95#pragma pack(push, 4) 95#pragma pack(push, 4)
96struct MiiInfoElement { 96struct MiiInfoElement {
97 MiiInfo info; 97 MiiInfo info{};
98 Source source; 98 Source source{};
99}; 99};
100static_assert(sizeof(MiiInfoElement) == 0x5C, "MiiInfoElement has incorrect size."); 100static_assert(sizeof(MiiInfoElement) == 0x5C, "MiiInfoElement has incorrect size.");
101 101
102struct MiiStoreBitFields { 102struct MiiStoreBitFields {
103 union { 103 union {
104 u32 word_0; 104 u32 word_0{};
105 105
106 BitField<24, 8, u32> hair_type; 106 BitField<24, 8, u32> hair_type;
107 BitField<23, 1, u32> mole_type; 107 BitField<23, 1, u32> mole_type;
@@ -112,7 +112,7 @@ struct MiiStoreBitFields {
112 }; 112 };
113 113
114 union { 114 union {
115 u32 word_1; 115 u32 word_1{};
116 116
117 BitField<31, 1, u32> gender; 117 BitField<31, 1, u32> gender;
118 BitField<24, 7, u32> eye_color; 118 BitField<24, 7, u32> eye_color;
@@ -122,7 +122,7 @@ struct MiiStoreBitFields {
122 }; 122 };
123 123
124 union { 124 union {
125 u32 word_2; 125 u32 word_2{};
126 126
127 BitField<31, 1, u32> mii_type; 127 BitField<31, 1, u32> mii_type;
128 BitField<24, 7, u32> glasses_color; 128 BitField<24, 7, u32> glasses_color;
@@ -135,7 +135,7 @@ struct MiiStoreBitFields {
135 }; 135 };
136 136
137 union { 137 union {
138 u32 word_3; 138 u32 word_3{};
139 139
140 BitField<29, 3, u32> mustache_type; 140 BitField<29, 3, u32> mustache_type;
141 BitField<24, 5, u32> eyebrow_type; 141 BitField<24, 5, u32> eyebrow_type;
@@ -148,7 +148,7 @@ struct MiiStoreBitFields {
148 }; 148 };
149 149
150 union { 150 union {
151 u32 word_4; 151 u32 word_4{};
152 152
153 BitField<29, 3, u32> eye_rotate; 153 BitField<29, 3, u32> eye_rotate;
154 BitField<24, 5, u32> mustache_y; 154 BitField<24, 5, u32> mustache_y;
@@ -160,7 +160,7 @@ struct MiiStoreBitFields {
160 }; 160 };
161 161
162 union { 162 union {
163 u32 word_5; 163 u32 word_5{};
164 164
165 BitField<24, 5, u32> glasses_type; 165 BitField<24, 5, u32> glasses_type;
166 BitField<20, 4, u32> face_type; 166 BitField<20, 4, u32> face_type;
@@ -172,7 +172,7 @@ struct MiiStoreBitFields {
172 }; 172 };
173 173
174 union { 174 union {
175 u32 word_6; 175 u32 word_6{};
176 176
177 BitField<28, 4, u32> eyebrow_rotate; 177 BitField<28, 4, u32> eyebrow_rotate;
178 BitField<24, 4, u32> eyebrow_scale; 178 BitField<24, 4, u32> eyebrow_scale;
@@ -192,30 +192,30 @@ struct MiiStoreData {
192 // This corresponds to the above structure MiiStoreBitFields. I did it like this because the 192 // This corresponds to the above structure MiiStoreBitFields. I did it like this because the
193 // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is 193 // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is
194 // not suitable for our uses. 194 // not suitable for our uses.
195 std::array<u8, 0x1C> data; 195 std::array<u8, 0x1C> data{};
196 static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); 196 static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size.");
197 197
198 std::array<char16_t, 10> name; 198 std::array<char16_t, 10> name{};
199 Common::UUID uuid; 199 Common::UUID uuid{Common::INVALID_UUID};
200 u16 crc_1; 200 u16 crc_1{};
201 u16 crc_2; 201 u16 crc_2{};
202 202
203 std::u16string Name() const; 203 std::u16string Name() const;
204}; 204};
205static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size."); 205static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size.");
206 206
207struct MiiStoreDataElement { 207struct MiiStoreDataElement {
208 MiiStoreData data; 208 MiiStoreData data{};
209 Source source; 209 Source source{};
210}; 210};
211static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size."); 211static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size.");
212 212
213struct MiiDatabase { 213struct MiiDatabase {
214 u32 magic; // 'NFDB' 214 u32 magic{}; // 'NFDB'
215 std::array<MiiStoreData, MAX_MIIS> miis; 215 std::array<MiiStoreData, MAX_MIIS> miis{};
216 INSERT_PADDING_BYTES(1); 216 INSERT_PADDING_BYTES(1);
217 u8 count; 217 u8 count{};
218 u16 crc; 218 u16 crc{};
219}; 219};
220static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size."); 220static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size.");
221#pragma pack(pop) 221#pragma pack(pop)
@@ -266,8 +266,8 @@ private:
266 void EnsureDatabasePartition(); 266 void EnsureDatabasePartition();
267 267
268 MiiDatabase database; 268 MiiDatabase database;
269 bool updated_flag = false; 269 bool updated_flag{};
270 bool is_test_mode_enabled = false; 270 bool is_test_mode_enabled{};
271}; 271};
272 272
273}; // namespace Service::Mii 273}; // namespace Service::Mii