summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorGravatar german772023-09-11 08:53:23 -0600
committerGravatar german772023-09-11 09:54:32 -0600
commitec25f847d8c066241d3aa9bb00bd11cb0c47b161 (patch)
tree0fb517718e80499316fcd1994e93355391844af3 /src/core
parentmii: Prepare Interface for new implementation (diff)
downloadyuzu-ec25f847d8c066241d3aa9bb00bd11cb0c47b161.tar.gz
yuzu-ec25f847d8c066241d3aa9bb00bd11cb0c47b161.tar.xz
yuzu-ec25f847d8c066241d3aa9bb00bd11cb0c47b161.zip
mii: service: Address review
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/mii/mii.cpp2
-rw-r--r--src/core/hle/service/mii/mii_manager.cpp6
-rw-r--r--src/core/hle/service/mii/mii_manager.h9
-rw-r--r--src/core/hle/service/mii/mii_types.h57
-rw-r--r--src/core/hle/service/mii/mii_util.h3
-rw-r--r--src/core/hle/service/mii/types/char_info.cpp112
-rw-r--r--src/core/hle/service/mii/types/char_info.h2
-rw-r--r--src/core/hle/service/mii/types/core_data.cpp12
-rw-r--r--src/core/hle/service/mii/types/raw_data.cpp2
-rw-r--r--src/core/hle/service/mii/types/raw_data.h2
-rw-r--r--src/core/hle/service/mii/types/ver3_store_data.cpp23
-rw-r--r--src/core/hle/service/mii/types/ver3_store_data.h6
12 files changed, 133 insertions, 103 deletions
diff --git a/src/core/hle/service/mii/mii.cpp b/src/core/hle/service/mii/mii.cpp
index 653c36740..3b83c5ed7 100644
--- a/src/core/hle/service/mii/mii.cpp
+++ b/src/core/hle/service/mii/mii.cpp
@@ -210,7 +210,7 @@ private:
210 LOG_DEBUG(Service_Mii, "called"); 210 LOG_DEBUG(Service_Mii, "called");
211 211
212 s32 index{}; 212 s32 index{};
213 const Result result = manager.GetIndex(metadata, info, index); 213 const auto result = manager.GetIndex(metadata, info, index);
214 214
215 IPC::ResponseBuilder rb{ctx, 3}; 215 IPC::ResponseBuilder rb{ctx, 3};
216 rb.Push(result); 216 rb.Push(result);
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp
index 153a484c0..292d63777 100644
--- a/src/core/hle/service/mii/mii_manager.cpp
+++ b/src/core/hle/service/mii/mii_manager.cpp
@@ -37,10 +37,10 @@ bool MiiManager::IsFullDatabase() const {
37 37
38u32 MiiManager::GetCount(const DatabaseSessionMetadata& metadata, SourceFlag source_flag) const { 38u32 MiiManager::GetCount(const DatabaseSessionMetadata& metadata, SourceFlag source_flag) const {
39 u32 mii_count{}; 39 u32 mii_count{};
40 if ((source_flag & SourceFlag::Default) == SourceFlag::None) { 40 if ((source_flag & SourceFlag::Default) != SourceFlag::None) {
41 mii_count += DefaultMiiCount; 41 mii_count += DefaultMiiCount;
42 } 42 }
43 if ((source_flag & SourceFlag::Database) == SourceFlag::None) { 43 if ((source_flag & SourceFlag::Database) != SourceFlag::None) {
44 // TODO(bunnei): We don't implement the Mii database, but when we do, update this 44 // TODO(bunnei): We don't implement the Mii database, but when we do, update this
45 } 45 }
46 return mii_count; 46 return mii_count;
@@ -153,7 +153,7 @@ Result MiiManager::BuildDefault(std::span<CharInfo> out_char_info, u32& out_coun
153Result MiiManager::GetIndex(const DatabaseSessionMetadata& metadata, const CharInfo& char_info, 153Result MiiManager::GetIndex(const DatabaseSessionMetadata& metadata, const CharInfo& char_info,
154 s32& out_index) { 154 s32& out_index) {
155 155
156 if (char_info.Verify() != 0) { 156 if (char_info.Verify() != ValidationResult::NoErrors) {
157 return ResultInvalidCharInfo; 157 return ResultInvalidCharInfo;
158 } 158 }
159 159
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h
index 4f8be06c3..a2e7a6d73 100644
--- a/src/core/hle/service/mii/mii_manager.h
+++ b/src/core/hle/service/mii/mii_manager.h
@@ -38,15 +38,6 @@ public:
38 s32& out_index); 38 s32& out_index);
39 void SetInterfaceVersion(DatabaseSessionMetadata& metadata, u32 version); 39 void SetInterfaceVersion(DatabaseSessionMetadata& metadata, u32 version);
40 40
41 struct MiiDatabase {
42 u32 magic{}; // 'NFDB'
43 std::array<StoreData, 0x64> miis{};
44 INSERT_PADDING_BYTES(1);
45 u8 count{};
46 u16 crc{};
47 };
48 static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size.");
49
50private: 41private:
51 Result BuildDefault(std::span<CharInfoElement> out_elements, u32& out_count, 42 Result BuildDefault(std::span<CharInfoElement> out_elements, u32& out_count,
52 SourceFlag source_flag); 43 SourceFlag source_flag);
diff --git a/src/core/hle/service/mii/mii_types.h b/src/core/hle/service/mii/mii_types.h
index b23ce477d..8fc827b5a 100644
--- a/src/core/hle/service/mii/mii_types.h
+++ b/src/core/hle/service/mii/mii_types.h
@@ -86,6 +86,61 @@ enum class SourceFlag : u32 {
86}; 86};
87DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); 87DECLARE_ENUM_FLAG_OPERATORS(SourceFlag);
88 88
89enum class ValidationResult : u32 {
90 NoErrors = 0x0,
91 InvalidBeardColor = 0x1,
92 InvalidBeardType = 0x2,
93 InvalidBuild = 0x3,
94 InvalidEyeAspect = 0x4,
95 InvalidEyeColor = 0x5,
96 InvalidEyeRotate = 0x6,
97 InvalidEyeScale = 0x7,
98 InvalidEyeType = 0x8,
99 InvalidEyeX = 0x9,
100 InvalidEyeY = 0xa,
101 InvalidEyebrowAspect = 0xb,
102 InvalidEyebrowColor = 0xc,
103 InvalidEyebrowRotate = 0xd,
104 InvalidEyebrowScale = 0xe,
105 InvalidEyebrowType = 0xf,
106 InvalidEyebrowX = 0x10,
107 InvalidEyebrowY = 0x11,
108 InvalidFacelineColor = 0x12,
109 InvalidFacelineMake = 0x13,
110 InvalidFacelineWrinkle = 0x14,
111 InvalidFacelineType = 0x15,
112 InvalidColor = 0x16,
113 InvalidFont = 0x17,
114 InvalidGender = 0x18,
115 InvalidGlassColor = 0x19,
116 InvalidGlassScale = 0x1a,
117 InvalidGlassType = 0x1b,
118 InvalidGlassY = 0x1c,
119 InvalidHairColor = 0x1d,
120 InvalidHairFlip = 0x1e,
121 InvalidHairType = 0x1f,
122 InvalidHeight = 0x20,
123 InvalidMoleScale = 0x21,
124 InvalidMoleType = 0x22,
125 InvalidMoleX = 0x23,
126 InvalidMoleY = 0x24,
127 InvalidMouthAspect = 0x25,
128 InvalidMouthColor = 0x26,
129 InvalidMouthScale = 0x27,
130 InvalidMouthType = 0x28,
131 InvalidMouthY = 0x29,
132 InvalidMustacheScale = 0x2a,
133 InvalidMustacheType = 0x2b,
134 InvalidMustacheY = 0x2c,
135 InvalidNoseScale = 0x2e,
136 InvalidNoseType = 0x2f,
137 InvalidNoseY = 0x30,
138 InvalidRegionMove = 0x31,
139 InvalidCreateId = 0x32,
140 InvalidName = 0x33,
141 InvalidType = 0x35,
142};
143
89struct Nickname { 144struct Nickname {
90 static constexpr std::size_t MaxNameSize = 10; 145 static constexpr std::size_t MaxNameSize = 10;
91 std::array<char16_t, MaxNameSize> data; 146 std::array<char16_t, MaxNameSize> data;
@@ -163,7 +218,7 @@ struct DefaultMii {
163 u32 type{}; 218 u32 type{};
164 Nickname nickname; 219 Nickname nickname;
165}; 220};
166static_assert(sizeof(DefaultMii) == 0xd8, "MiiStoreData has incorrect size."); 221static_assert(sizeof(DefaultMii) == 0xd8, "DefaultMii has incorrect size.");
167 222
168struct DatabaseSessionMetadata { 223struct DatabaseSessionMetadata {
169 u32 interface_version; 224 u32 interface_version;
diff --git a/src/core/hle/service/mii/mii_util.h b/src/core/hle/service/mii/mii_util.h
index 782ffe22f..ddb544c23 100644
--- a/src/core/hle/service/mii/mii_util.h
+++ b/src/core/hle/service/mii/mii_util.h
@@ -4,6 +4,7 @@
4#pragma once 4#pragma once
5 5
6#include <random> 6#include <random>
7#include <span>
7 8
8#include "common/common_types.h" 9#include "common/common_types.h"
9#include "common/swap.h" 10#include "common/swap.h"
@@ -51,7 +52,7 @@ public:
51 } 52 }
52 53
53 static bool IsFontRegionValid(FontRegion font, std::span<const char16_t> text) { 54 static bool IsFontRegionValid(FontRegion font, std::span<const char16_t> text) {
54 // Todo:: This function needs to check against the font tables 55 // TODO: This function needs to check against the font tables
55 return true; 56 return true;
56 } 57 }
57}; 58};
diff --git a/src/core/hle/service/mii/types/char_info.cpp b/src/core/hle/service/mii/types/char_info.cpp
index 0f9c37b84..cd7154c91 100644
--- a/src/core/hle/service/mii/types/char_info.cpp
+++ b/src/core/hle/service/mii/types/char_info.cpp
@@ -62,161 +62,161 @@ void CharInfo::SetFromStoreData(const StoreData& store_data) {
62 padding = '\0'; 62 padding = '\0';
63} 63}
64 64
65u32 CharInfo::Verify() const { 65ValidationResult CharInfo::Verify() const {
66 if (!create_id.IsValid()) { 66 if (!create_id.IsValid()) {
67 return 0x32; 67 return ValidationResult::InvalidCreateId;
68 } 68 }
69 if (!name.IsValid()) { 69 if (!name.IsValid()) {
70 return 0x33; 70 return ValidationResult::InvalidName;
71 } 71 }
72 if (3 < font_region) { 72 if (3 < font_region) {
73 return 0x17; 73 return ValidationResult::InvalidFont;
74 } 74 }
75 if (0xb < favorite_color) { 75 if (0xb < favorite_color) {
76 return 0x16; 76 return ValidationResult::InvalidColor;
77 } 77 }
78 if (1 < gender) { 78 if (1 < gender) {
79 return 0x18; 79 return ValidationResult::InvalidGender;
80 } 80 }
81 if (height < 0) { 81 if (height > 0x7f) {
82 return 0x20; 82 return ValidationResult::InvalidHeight;
83 } 83 }
84 if (build < 0) { 84 if (build > 0x7f) {
85 return 3; 85 return ValidationResult::InvalidBuild;
86 } 86 }
87 if (1 < type) { 87 if (1 < type) {
88 return 0x35; 88 return ValidationResult::InvalidType;
89 } 89 }
90 if (3 < region_move) { 90 if (3 < region_move) {
91 return 0x31; 91 return ValidationResult::InvalidRegionMove;
92 } 92 }
93 if (0xb < faceline_type) { 93 if (0xb < faceline_type) {
94 return 0x15; 94 return ValidationResult::InvalidFacelineType;
95 } 95 }
96 if (9 < faceline_color) { 96 if (9 < faceline_color) {
97 return 0x12; 97 return ValidationResult::InvalidFacelineColor;
98 } 98 }
99 if (0xb < faceline_wrinkle) { 99 if (0xb < faceline_wrinkle) {
100 return 0x14; 100 return ValidationResult::InvalidFacelineWrinkle;
101 } 101 }
102 if (0xb < faceline_make) { 102 if (0xb < faceline_make) {
103 return 0x13; 103 return ValidationResult::InvalidFacelineMake;
104 } 104 }
105 if (0x83 < hair_type) { 105 if (0x83 < hair_type) {
106 return 0x1f; 106 return ValidationResult::InvalidHairType;
107 } 107 }
108 if (99 < hair_color) { 108 if (99 < hair_color) {
109 return 0x1d; 109 return ValidationResult::InvalidHairColor;
110 } 110 }
111 if (1 < hair_flip) { 111 if (1 < hair_flip) {
112 return 0x1e; 112 return ValidationResult::InvalidHairFlip;
113 } 113 }
114 if (0x3b < eye_type) { 114 if (0x3b < eye_type) {
115 return 8; 115 return ValidationResult::InvalidEyeType;
116 } 116 }
117 if (99 < eye_color) { 117 if (99 < eye_color) {
118 return 5; 118 return ValidationResult::InvalidEyeColor;
119 } 119 }
120 if (7 < eye_scale) { 120 if (7 < eye_scale) {
121 return 7; 121 return ValidationResult::InvalidEyeScale;
122 } 122 }
123 if (6 < eye_aspect) { 123 if (6 < eye_aspect) {
124 return 4; 124 return ValidationResult::InvalidEyeAspect;
125 } 125 }
126 if (7 < eye_rotate) { 126 if (7 < eye_rotate) {
127 return 6; 127 return ValidationResult::InvalidEyeRotate;
128 } 128 }
129 if (0xc < eye_x) { 129 if (0xc < eye_x) {
130 return 9; 130 return ValidationResult::InvalidEyeX;
131 } 131 }
132 if (0x12 < eye_y) { 132 if (0x12 < eye_y) {
133 return 10; 133 return ValidationResult::InvalidEyeY;
134 } 134 }
135 if (0x17 < eyebrow_type) { 135 if (0x17 < eyebrow_type) {
136 return 0xf; 136 return ValidationResult::InvalidEyebrowType;
137 } 137 }
138 if (99 < eyebrow_color) { 138 if (99 < eyebrow_color) {
139 return 0xc; 139 return ValidationResult::InvalidEyebrowColor;
140 } 140 }
141 if (8 < eyebrow_scale) { 141 if (8 < eyebrow_scale) {
142 return 0xe; 142 return ValidationResult::InvalidEyebrowScale;
143 } 143 }
144 if (6 < eyebrow_aspect) { 144 if (6 < eyebrow_aspect) {
145 return 0xb; 145 return ValidationResult::InvalidEyebrowAspect;
146 } 146 }
147 if (0xb < eyebrow_rotate) { 147 if (0xb < eyebrow_rotate) {
148 return 0xd; 148 return ValidationResult::InvalidEyebrowRotate;
149 } 149 }
150 if (0xc < eyebrow_x) { 150 if (0xc < eyebrow_x) {
151 return 0x10; 151 return ValidationResult::InvalidEyebrowX;
152 } 152 }
153 if (0xf < eyebrow_y - 3) { 153 if (0xf < eyebrow_y - 3) {
154 return 0x11; 154 return ValidationResult::InvalidEyebrowY;
155 } 155 }
156 if (0x11 < nose_type) { 156 if (0x11 < nose_type) {
157 return 0x2f; 157 return ValidationResult::InvalidNoseType;
158 } 158 }
159 if (nose_scale >= 9) { 159 if (nose_scale >= 9) {
160 return 0x2e; 160 return ValidationResult::InvalidNoseScale;
161 } 161 }
162 if (0x12 < nose_y) { 162 if (0x12 < nose_y) {
163 return 0x30; 163 return ValidationResult::InvalidNoseY;
164 } 164 }
165 if (0x23 < mouth_type) { 165 if (0x23 < mouth_type) {
166 return 0x28; 166 return ValidationResult::InvalidMouthType;
167 } 167 }
168 if (99 < mouth_color) { 168 if (99 < mouth_color) {
169 return 0x26; 169 return ValidationResult::InvalidMouthColor;
170 } 170 }
171 if (8 < mouth_scale) { 171 if (8 < mouth_scale) {
172 return 0x27; 172 return ValidationResult::InvalidMouthScale;
173 } 173 }
174 if (6 < mouth_aspect) { 174 if (6 < mouth_aspect) {
175 return 0x25; 175 return ValidationResult::InvalidMouthAspect;
176 } 176 }
177 if (0x12 < mouth_y) { 177 if (0x12 < mouth_y) {
178 return 0x29; 178 return ValidationResult::InvalidMoleY;
179 } 179 }
180 if (99 < beard_color) { 180 if (99 < beard_color) {
181 return 1; 181 return ValidationResult::InvalidBeardColor;
182 } 182 }
183 if (5 < beard_type) { 183 if (5 < beard_type) {
184 return 2; 184 return ValidationResult::InvalidBeardType;
185 } 185 }
186 if (5 < mustache_type) { 186 if (5 < mustache_type) {
187 return 0x2b; 187 return ValidationResult::InvalidMustacheType;
188 } 188 }
189 if (8 < mustache_scale) { 189 if (8 < mustache_scale) {
190 return 0x2a; 190 return ValidationResult::InvalidMustacheScale;
191 } 191 }
192 if (0x10 < mustache_y) { 192 if (0x10 < mustache_y) {
193 return 0x2c; 193 return ValidationResult::InvalidMustacheY;
194 } 194 }
195 if (0x13 < glasses_type) { 195 if (0x13 < glasses_type) {
196 return 0x1b; 196 return ValidationResult::InvalidGlassType;
197 } 197 }
198 if (99 < glasses_color) { 198 if (99 < glasses_color) {
199 return 0x19; 199 return ValidationResult::InvalidGlassColor;
200 } 200 }
201 if (7 < glasses_scale) { 201 if (7 < glasses_scale) {
202 return 0x1a; 202 return ValidationResult::InvalidGlassScale;
203 } 203 }
204 if (0x14 < glasses_y) { 204 if (0x14 < glasses_y) {
205 return 0x1c; 205 return ValidationResult::InvalidGlassY;
206 } 206 }
207 if (mole_type >= 2) { 207 if (mole_type >= 2) {
208 return 0x22; 208 return ValidationResult::InvalidMoleType;
209 } 209 }
210 if (8 < mole_scale) { 210 if (8 < mole_scale) {
211 return 0x21; 211 return ValidationResult::InvalidMoleScale;
212 } 212 }
213 if (mole_x >= 0x11) { 213 if (mole_x >= 0x11) {
214 return 0x23; 214 return ValidationResult::InvalidMoleX;
215 } 215 }
216 if (0x1e < mole_y) { 216 if (0x1e < mole_y) {
217 return 0x24; 217 return ValidationResult::InvalidMoleY;
218 } 218 }
219 return 0; 219 return ValidationResult::NoErrors;
220} 220}
221 221
222Common::UUID CharInfo::GetCreateId() const { 222Common::UUID CharInfo::GetCreateId() const {
@@ -424,7 +424,7 @@ u8 CharInfo::GetMoleY() const {
424} 424}
425 425
426bool CharInfo::operator==(const CharInfo& info) { 426bool CharInfo::operator==(const CharInfo& info) {
427 bool is_identical = info.Verify() == 0; 427 bool is_identical = info.Verify() == ValidationResult::NoErrors;
428 is_identical &= name.data == info.GetNickname().data; 428 is_identical &= name.data == info.GetNickname().data;
429 is_identical &= create_id == info.GetCreateId(); 429 is_identical &= create_id == info.GetCreateId();
430 is_identical &= font_region == info.GetFontRegion(); 430 is_identical &= font_region == info.GetFontRegion();
diff --git a/src/core/hle/service/mii/types/char_info.h b/src/core/hle/service/mii/types/char_info.h
index 4f70edc24..65a7707d3 100644
--- a/src/core/hle/service/mii/types/char_info.h
+++ b/src/core/hle/service/mii/types/char_info.h
@@ -13,7 +13,7 @@ class CharInfo {
13public: 13public:
14 void SetFromStoreData(const StoreData& store_data_raw); 14 void SetFromStoreData(const StoreData& store_data_raw);
15 15
16 u32 Verify() const; 16 ValidationResult Verify() const;
17 17
18 Common::UUID GetCreateId() const; 18 Common::UUID GetCreateId() const;
19 Nickname GetNickname() const; 19 Nickname GetNickname() const;
diff --git a/src/core/hle/service/mii/types/core_data.cpp b/src/core/hle/service/mii/types/core_data.cpp
index 9d7e604a9..de82481b0 100644
--- a/src/core/hle/service/mii/types/core_data.cpp
+++ b/src/core/hle/service/mii/types/core_data.cpp
@@ -26,10 +26,10 @@ void CoreData::BuildRandom(Age age, Gender gender, Race race) {
26 data.build.Assign(64); 26 data.build.Assign(64);
27 27
28 if (age == Age::All) { 28 if (age == Age::All) {
29 const auto temp{MiiUtil::GetRandomValue<int>(10)}; 29 const auto random{MiiUtil::GetRandomValue<int>(10)};
30 if (temp >= 8) { 30 if (random >= 8) {
31 age = Age::Old; 31 age = Age::Old;
32 } else if (temp >= 4) { 32 } else if (random >= 4) {
33 age = Age::Normal; 33 age = Age::Normal;
34 } else { 34 } else {
35 age = Age::Young; 35 age = Age::Young;
@@ -37,10 +37,10 @@ void CoreData::BuildRandom(Age age, Gender gender, Race race) {
37 } 37 }
38 38
39 if (race == Race::All) { 39 if (race == Race::All) {
40 const auto temp{MiiUtil::GetRandomValue<int>(10)}; 40 const auto random{MiiUtil::GetRandomValue<int>(10)};
41 if (temp >= 8) { 41 if (random >= 8) {
42 race = Race::Black; 42 race = Race::Black;
43 } else if (temp >= 4) { 43 } else if (random >= 4) {
44 race = Race::White; 44 race = Race::White;
45 } else { 45 } else {
46 race = Race::Asian; 46 race = Race::Asian;
diff --git a/src/core/hle/service/mii/types/raw_data.cpp b/src/core/hle/service/mii/types/raw_data.cpp
index ef678c527..ed299521f 100644
--- a/src/core/hle/service/mii/types/raw_data.cpp
+++ b/src/core/hle/service/mii/types/raw_data.cpp
@@ -5,7 +5,7 @@
5 5
6namespace Service::Mii::RawData { 6namespace Service::Mii::RawData {
7 7
8constexpr std::array<u8, 0x10> FromVer3FacelineColorTable{ 8constexpr std::array<u8, 16> FromVer3FacelineColorTable{
9 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x0, 0x1, 0x5, 0x5, 9 0x0, 0x1, 0x2, 0x3, 0x4, 0x5, 0x0, 0x1, 0x5, 0x5,
10}; 10};
11 11
diff --git a/src/core/hle/service/mii/types/raw_data.h b/src/core/hle/service/mii/types/raw_data.h
index 180f49fd0..8c910096f 100644
--- a/src/core/hle/service/mii/types/raw_data.h
+++ b/src/core/hle/service/mii/types/raw_data.h
@@ -10,7 +10,7 @@
10namespace Service::Mii::RawData { 10namespace Service::Mii::RawData {
11 11
12struct RandomMiiValues { 12struct RandomMiiValues {
13 std::array<u8, 0xbc> values{}; 13 std::array<u8, 188> values{};
14}; 14};
15static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size."); 15static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size.");
16 16
diff --git a/src/core/hle/service/mii/types/ver3_store_data.cpp b/src/core/hle/service/mii/types/ver3_store_data.cpp
index 53a3fe44b..c7624520c 100644
--- a/src/core/hle/service/mii/types/ver3_store_data.cpp
+++ b/src/core/hle/service/mii/types/ver3_store_data.cpp
@@ -33,16 +33,7 @@ void Ver3StoreData::BuildToStoreData(StoreData& out_store_data) const {
33 out_store_data.SetHeight(height); 33 out_store_data.SetHeight(height);
34 out_store_data.SetBuild(build); 34 out_store_data.SetBuild(build);
35 35
36 // Copy name until string terminator 36 out_store_data.SetNickname(mii_name);
37 Nickname name = {};
38 for (std::size_t index = 0; index < name.data.size() - 1; index++) {
39 name.data[index] = mii_name[index];
40 if (name.data[index] == 0) {
41 break;
42 }
43 }
44
45 out_store_data.SetNickname(name);
46 out_store_data.SetFontRegion( 37 out_store_data.SetFontRegion(
47 static_cast<FontRegion>(static_cast<u8>(region_information.font_region))); 38 static_cast<FontRegion>(static_cast<u8>(region_information.font_region)));
48 39
@@ -108,15 +99,7 @@ void Ver3StoreData::BuildFromStoreData(const StoreData& store_data) {
108 height = store_data.GetHeight(); 99 height = store_data.GetHeight();
109 build = store_data.GetBuild(); 100 build = store_data.GetBuild();
110 101
111 // Copy name until string terminator 102 mii_name = store_data.GetNickname();
112 mii_name = {};
113 for (std::size_t index = 0; index < store_data.GetNickname().data.size() - 1; index++) {
114 mii_name[index] = store_data.GetNickname().data[index];
115 if (mii_name[index] == 0) {
116 break;
117 }
118 }
119
120 region_information.font_region.Assign(static_cast<u8>(store_data.GetFontRegion())); 103 region_information.font_region.Assign(static_cast<u8>(store_data.GetFontRegion()));
121 104
122 appearance_bits1.faceline_type.Assign(store_data.GetFacelineType()); 105 appearance_bits1.faceline_type.Assign(store_data.GetFacelineType());
@@ -183,7 +166,7 @@ void Ver3StoreData::BuildFromStoreData(const StoreData& store_data) {
183u32 Ver3StoreData::IsValid() const { 166u32 Ver3StoreData::IsValid() const {
184 bool is_valid = version == 0 || version == 3; 167 bool is_valid = version == 0 || version == 3;
185 168
186 is_valid = is_valid && (mii_name[0] != 0); 169 is_valid = is_valid && (mii_name.data[0] != 0);
187 170
188 is_valid = is_valid && (mii_information.birth_month < 13); 171 is_valid = is_valid && (mii_information.birth_month < 13);
189 is_valid = is_valid && (mii_information.birth_day < 32); 172 is_valid = is_valid && (mii_information.birth_day < 32);
diff --git a/src/core/hle/service/mii/types/ver3_store_data.h b/src/core/hle/service/mii/types/ver3_store_data.h
index 11caeb5c3..47907bf7d 100644
--- a/src/core/hle/service/mii/types/ver3_store_data.h
+++ b/src/core/hle/service/mii/types/ver3_store_data.h
@@ -47,7 +47,7 @@ public:
47 u16_be mii_id; 47 u16_be mii_id;
48 u64_be system_id; 48 u64_be system_id;
49 u32_be specialness_and_creation_date; 49 u32_be specialness_and_creation_date;
50 std::array<u8, 0x6> creator_mac; 50 std::array<u8, 6> creator_mac;
51 u16_be padding; 51 u16_be padding;
52 union { 52 union {
53 u16 raw; 53 u16 raw;
@@ -58,7 +58,7 @@ public:
58 BitField<10, 4, u16> favorite_color; 58 BitField<10, 4, u16> favorite_color;
59 BitField<14, 1, u16> favorite; 59 BitField<14, 1, u16> favorite;
60 } mii_information; 60 } mii_information;
61 std::array<char16_t, 0xA> mii_name; 61 Nickname mii_name;
62 u8 height; 62 u8 height;
63 u8 build; 63 u8 build;
64 union { 64 union {
@@ -150,7 +150,7 @@ public:
150 BitField<10, 5, u16> mole_y; 150 BitField<10, 5, u16> mole_y;
151 } appearance_bits11; 151 } appearance_bits11;
152 152
153 std::array<u16_le, 0xA> author_name; 153 Nickname author_name;
154 INSERT_PADDING_BYTES(0x2); 154 INSERT_PADDING_BYTES(0x2);
155 u16_be crc; 155 u16_be crc;
156}; 156};