diff options
| author | 2023-09-10 22:52:33 -0600 | |
|---|---|---|
| committer | 2023-09-10 22:52:33 -0600 | |
| commit | 81f50d51326fc1ce401bd21c28cf78371b4ddcea (patch) | |
| tree | bbcb3092365b19a19ad8ee4caa690f075f505a11 /src | |
| parent | service: mii: Move ver3 operations (diff) | |
| download | yuzu-81f50d51326fc1ce401bd21c28cf78371b4ddcea.tar.gz yuzu-81f50d51326fc1ce401bd21c28cf78371b4ddcea.tar.xz yuzu-81f50d51326fc1ce401bd21c28cf78371b4ddcea.zip | |
service: mii: Move core data operations
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 249 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/core_data.cpp | 597 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/core_data.h | 111 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/store_data.cpp | 16 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/store_data.h | 3 |
5 files changed, 730 insertions, 246 deletions
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 9ae7fb960..3483d95e5 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -90,256 +90,21 @@ CharInfo ConvertStoreDataToInfo(const StoreData& data) { | |||
| 90 | } | 90 | } |
| 91 | 91 | ||
| 92 | StoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { | 92 | StoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { |
| 93 | StoreDataBitFields bf{}; | 93 | CoreData core_data{}; |
| 94 | core_data.BuildRandom(age, gender, race); | ||
| 94 | 95 | ||
| 95 | if (gender == Gender::All) { | 96 | return {DefaultMiiName, core_data.data, user_id}; |
| 96 | gender = MiiUtil::GetRandomValue<Gender>(Gender::Maximum); | ||
| 97 | } | ||
| 98 | |||
| 99 | bf.gender.Assign(gender); | ||
| 100 | bf.favorite_color.Assign(MiiUtil::GetRandomValue<u8>(11)); | ||
| 101 | bf.region_move.Assign(0); | ||
| 102 | bf.font_region.Assign(FontRegion::Standard); | ||
| 103 | bf.type.Assign(0); | ||
| 104 | bf.height.Assign(64); | ||
| 105 | bf.build.Assign(64); | ||
| 106 | |||
| 107 | if (age == Age::All) { | ||
| 108 | const auto temp{MiiUtil::GetRandomValue<int>(10)}; | ||
| 109 | if (temp >= 8) { | ||
| 110 | age = Age::Old; | ||
| 111 | } else if (temp >= 4) { | ||
| 112 | age = Age::Normal; | ||
| 113 | } else { | ||
| 114 | age = Age::Young; | ||
| 115 | } | ||
| 116 | } | ||
| 117 | |||
| 118 | if (race == Race::All) { | ||
| 119 | const auto temp{MiiUtil::GetRandomValue<int>(10)}; | ||
| 120 | if (temp >= 8) { | ||
| 121 | race = Race::Black; | ||
| 122 | } else if (temp >= 4) { | ||
| 123 | race = Race::White; | ||
| 124 | } else { | ||
| 125 | race = Race::Asian; | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | u32 axis_y{}; | ||
| 130 | if (gender == Gender::Female && age == Age::Young) { | ||
| 131 | axis_y = MiiUtil::GetRandomValue<u32>(3); | ||
| 132 | } | ||
| 133 | |||
| 134 | const std::size_t index{3 * static_cast<std::size_t>(age) + | ||
| 135 | 9 * static_cast<std::size_t>(gender) + static_cast<std::size_t>(race)}; | ||
| 136 | |||
| 137 | const auto& faceline_type_info{RawData::RandomMiiFaceline.at(index)}; | ||
| 138 | const auto& faceline_color_info{RawData::RandomMiiFacelineColor.at( | ||
| 139 | 3 * static_cast<std::size_t>(gender) + static_cast<std::size_t>(race))}; | ||
| 140 | const auto& faceline_wrinkle_info{RawData::RandomMiiFacelineWrinkle.at(index)}; | ||
| 141 | const auto& faceline_makeup_info{RawData::RandomMiiFacelineMakeup.at(index)}; | ||
| 142 | const auto& hair_type_info{RawData::RandomMiiHairType.at(index)}; | ||
| 143 | const auto& hair_color_info{RawData::RandomMiiHairColor.at(3 * static_cast<std::size_t>(race) + | ||
| 144 | static_cast<std::size_t>(age))}; | ||
| 145 | const auto& eye_type_info{RawData::RandomMiiEyeType.at(index)}; | ||
| 146 | const auto& eye_color_info{RawData::RandomMiiEyeColor.at(static_cast<std::size_t>(race))}; | ||
| 147 | const auto& eyebrow_type_info{RawData::RandomMiiEyebrowType.at(index)}; | ||
| 148 | const auto& nose_type_info{RawData::RandomMiiNoseType.at(index)}; | ||
| 149 | const auto& mouth_type_info{RawData::RandomMiiMouthType.at(index)}; | ||
| 150 | const auto& glasses_type_info{RawData::RandomMiiGlassType.at(static_cast<std::size_t>(age))}; | ||
| 151 | |||
| 152 | bf.faceline_type.Assign( | ||
| 153 | faceline_type_info | ||
| 154 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_type_info.values_count)]); | ||
| 155 | bf.faceline_color.Assign( | ||
| 156 | faceline_color_info | ||
| 157 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_color_info.values_count)]); | ||
| 158 | bf.faceline_wrinkle.Assign( | ||
| 159 | faceline_wrinkle_info | ||
| 160 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_wrinkle_info.values_count)]); | ||
| 161 | bf.faceline_makeup.Assign( | ||
| 162 | faceline_makeup_info | ||
| 163 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_makeup_info.values_count)]); | ||
| 164 | |||
| 165 | bf.hair_type.Assign( | ||
| 166 | hair_type_info.values[MiiUtil::GetRandomValue<std::size_t>(hair_type_info.values_count)]); | ||
| 167 | bf.hair_color.Assign(RawData::GetHairColorFromVer3( | ||
| 168 | hair_color_info | ||
| 169 | .values[MiiUtil::GetRandomValue<std::size_t>(hair_color_info.values_count)])); | ||
| 170 | bf.hair_flip.Assign(MiiUtil::GetRandomValue<HairFlip>(HairFlip::Maximum)); | ||
| 171 | |||
| 172 | bf.eye_type.Assign( | ||
| 173 | eye_type_info.values[MiiUtil::GetRandomValue<std::size_t>(eye_type_info.values_count)]); | ||
| 174 | |||
| 175 | const auto eye_rotate_1{gender != Gender::Male ? 4 : 2}; | ||
| 176 | const auto eye_rotate_2{gender != Gender::Male ? 3 : 4}; | ||
| 177 | const auto eye_rotate_offset{32 - RawData::EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; | ||
| 178 | const auto eye_rotate{32 - RawData::EyeRotateLookup[bf.eye_type]}; | ||
| 179 | |||
| 180 | bf.eye_color.Assign(RawData::GetEyeColorFromVer3( | ||
| 181 | eye_color_info.values[MiiUtil::GetRandomValue<std::size_t>(eye_color_info.values_count)])); | ||
| 182 | bf.eye_scale.Assign(4); | ||
| 183 | bf.eye_aspect.Assign(3); | ||
| 184 | bf.eye_rotate.Assign(eye_rotate_offset - eye_rotate); | ||
| 185 | bf.eye_x.Assign(2); | ||
| 186 | bf.eye_y.Assign(axis_y + 12); | ||
| 187 | |||
| 188 | bf.eyebrow_type.Assign( | ||
| 189 | eyebrow_type_info | ||
| 190 | .values[MiiUtil::GetRandomValue<std::size_t>(eyebrow_type_info.values_count)]); | ||
| 191 | |||
| 192 | const auto eyebrow_rotate_1{race == Race::Asian ? 6 : 0}; | ||
| 193 | const auto eyebrow_y{race == Race::Asian ? 9 : 10}; | ||
| 194 | const auto eyebrow_rotate_offset{32 - RawData::EyebrowRotateLookup[eyebrow_rotate_1] + 6}; | ||
| 195 | const auto eyebrow_rotate{ | ||
| 196 | 32 - RawData::EyebrowRotateLookup[static_cast<std::size_t>(bf.eyebrow_type.Value())]}; | ||
| 197 | |||
| 198 | bf.eyebrow_color.Assign(bf.hair_color); | ||
| 199 | bf.eyebrow_scale.Assign(4); | ||
| 200 | bf.eyebrow_aspect.Assign(3); | ||
| 201 | bf.eyebrow_rotate.Assign(eyebrow_rotate_offset - eyebrow_rotate); | ||
| 202 | bf.eyebrow_x.Assign(2); | ||
| 203 | bf.eyebrow_y.Assign(axis_y + eyebrow_y); | ||
| 204 | |||
| 205 | const auto nose_scale{gender == Gender::Female ? 3 : 4}; | ||
| 206 | |||
| 207 | bf.nose_type.Assign( | ||
| 208 | nose_type_info.values[MiiUtil::GetRandomValue<std::size_t>(nose_type_info.values_count)]); | ||
| 209 | bf.nose_scale.Assign(nose_scale); | ||
| 210 | bf.nose_y.Assign(axis_y + 9); | ||
| 211 | |||
| 212 | const auto mouth_color{gender == Gender::Female ? MiiUtil::GetRandomValue<int>(4) : 0}; | ||
| 213 | |||
| 214 | bf.mouth_type.Assign( | ||
| 215 | mouth_type_info.values[MiiUtil::GetRandomValue<std::size_t>(mouth_type_info.values_count)]); | ||
| 216 | bf.mouth_color.Assign(RawData::GetMouthColorFromVer3(mouth_color)); | ||
| 217 | bf.mouth_scale.Assign(4); | ||
| 218 | bf.mouth_aspect.Assign(3); | ||
| 219 | bf.mouth_y.Assign(axis_y + 13); | ||
| 220 | |||
| 221 | bf.beard_color.Assign(bf.hair_color); | ||
| 222 | bf.mustache_scale.Assign(4); | ||
| 223 | |||
| 224 | if (gender == Gender::Male && age != Age::Young && MiiUtil::GetRandomValue<int>(10) < 2) { | ||
| 225 | const auto mustache_and_beard_flag{ | ||
| 226 | MiiUtil::GetRandomValue<BeardAndMustacheFlag>(BeardAndMustacheFlag::All)}; | ||
| 227 | |||
| 228 | auto beard_type{BeardType::None}; | ||
| 229 | auto mustache_type{MustacheType::None}; | ||
| 230 | |||
| 231 | if ((mustache_and_beard_flag & BeardAndMustacheFlag::Beard) == | ||
| 232 | BeardAndMustacheFlag::Beard) { | ||
| 233 | beard_type = MiiUtil::GetRandomValue<BeardType>(BeardType::Beard1, BeardType::Beard5); | ||
| 234 | } | ||
| 235 | |||
| 236 | if ((mustache_and_beard_flag & BeardAndMustacheFlag::Mustache) == | ||
| 237 | BeardAndMustacheFlag::Mustache) { | ||
| 238 | mustache_type = MiiUtil::GetRandomValue<MustacheType>(MustacheType::Mustache1, | ||
| 239 | MustacheType::Mustache5); | ||
| 240 | } | ||
| 241 | |||
| 242 | bf.mustache_type.Assign(mustache_type); | ||
| 243 | bf.beard_type.Assign(beard_type); | ||
| 244 | bf.mustache_y.Assign(10); | ||
| 245 | } else { | ||
| 246 | bf.mustache_type.Assign(MustacheType::None); | ||
| 247 | bf.beard_type.Assign(BeardType::None); | ||
| 248 | bf.mustache_y.Assign(axis_y + 10); | ||
| 249 | } | ||
| 250 | |||
| 251 | const auto glasses_type_start{MiiUtil::GetRandomValue<std::size_t>(100)}; | ||
| 252 | u8 glasses_type{}; | ||
| 253 | while (glasses_type_start < glasses_type_info.values[glasses_type]) { | ||
| 254 | if (++glasses_type >= glasses_type_info.values_count) { | ||
| 255 | ASSERT(false); | ||
| 256 | break; | ||
| 257 | } | ||
| 258 | } | ||
| 259 | |||
| 260 | bf.glasses_type.Assign(glasses_type); | ||
| 261 | bf.glasses_color.Assign(RawData::GetGlassColorFromVer3(0)); | ||
| 262 | bf.glasses_scale.Assign(4); | ||
| 263 | bf.glasses_y.Assign(axis_y + 10); | ||
| 264 | |||
| 265 | bf.mole_type.Assign(0); | ||
| 266 | bf.mole_scale.Assign(4); | ||
| 267 | bf.mole_x.Assign(2); | ||
| 268 | bf.mole_y.Assign(20); | ||
| 269 | |||
| 270 | return {DefaultMiiName, bf, user_id}; | ||
| 271 | } | 97 | } |
| 272 | 98 | ||
| 273 | StoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { | 99 | StoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { |
| 274 | StoreDataBitFields bf{}; | 100 | CoreData core_data{}; |
| 275 | 101 | core_data.SetDefault(); | |
| 276 | bf.font_region.Assign(info.font_region); | 102 | |
| 277 | bf.favorite_color.Assign(info.favorite_color); | 103 | return {DefaultMiiName, core_data.data, user_id}; |
| 278 | bf.gender.Assign(info.gender); | ||
| 279 | bf.height.Assign(info.height); | ||
| 280 | bf.build.Assign(info.weight); | ||
| 281 | bf.type.Assign(info.type); | ||
| 282 | bf.region_move.Assign(info.region_move); | ||
| 283 | bf.faceline_type.Assign(info.face_type); | ||
| 284 | bf.faceline_color.Assign(info.face_color); | ||
| 285 | bf.faceline_wrinkle.Assign(info.face_wrinkle); | ||
| 286 | bf.faceline_makeup.Assign(info.face_makeup); | ||
| 287 | bf.hair_type.Assign(info.hair_type); | ||
| 288 | bf.hair_color.Assign(RawData::GetHairColorFromVer3(info.hair_color)); | ||
| 289 | bf.hair_flip.Assign(static_cast<HairFlip>(info.hair_flip)); | ||
| 290 | bf.eye_type.Assign(info.eye_type); | ||
| 291 | bf.eye_color.Assign(RawData::GetEyeColorFromVer3(info.eye_color)); | ||
| 292 | bf.eye_scale.Assign(info.eye_scale); | ||
| 293 | bf.eye_aspect.Assign(info.eye_aspect); | ||
| 294 | bf.eye_rotate.Assign(info.eye_rotate); | ||
| 295 | bf.eye_x.Assign(info.eye_x); | ||
| 296 | bf.eye_y.Assign(info.eye_y); | ||
| 297 | bf.eyebrow_type.Assign(info.eyebrow_type); | ||
| 298 | bf.eyebrow_color.Assign(RawData::GetHairColorFromVer3(info.eyebrow_color)); | ||
| 299 | bf.eyebrow_scale.Assign(info.eyebrow_scale); | ||
| 300 | bf.eyebrow_aspect.Assign(info.eyebrow_aspect); | ||
| 301 | bf.eyebrow_rotate.Assign(info.eyebrow_rotate); | ||
| 302 | bf.eyebrow_x.Assign(info.eyebrow_x); | ||
| 303 | bf.eyebrow_y.Assign(info.eyebrow_y - 3); | ||
| 304 | bf.nose_type.Assign(info.nose_type); | ||
| 305 | bf.nose_scale.Assign(info.nose_scale); | ||
| 306 | bf.nose_y.Assign(info.nose_y); | ||
| 307 | bf.mouth_type.Assign(info.mouth_type); | ||
| 308 | bf.mouth_color.Assign(RawData::GetMouthColorFromVer3(info.mouth_color)); | ||
| 309 | bf.mouth_scale.Assign(info.mouth_scale); | ||
| 310 | bf.mouth_aspect.Assign(info.mouth_aspect); | ||
| 311 | bf.mouth_y.Assign(info.mouth_y); | ||
| 312 | bf.beard_color.Assign(RawData::GetHairColorFromVer3(info.beard_color)); | ||
| 313 | bf.beard_type.Assign(static_cast<BeardType>(info.beard_type)); | ||
| 314 | bf.mustache_type.Assign(static_cast<MustacheType>(info.mustache_type)); | ||
| 315 | bf.mustache_scale.Assign(info.mustache_scale); | ||
| 316 | bf.mustache_y.Assign(info.mustache_y); | ||
| 317 | bf.glasses_type.Assign(info.glasses_type); | ||
| 318 | bf.glasses_color.Assign(RawData::GetGlassColorFromVer3(static_cast<u8>(info.glasses_color))); | ||
| 319 | bf.glasses_scale.Assign(info.glasses_scale); | ||
| 320 | bf.glasses_y.Assign(info.glasses_y); | ||
| 321 | bf.mole_type.Assign(info.mole_type); | ||
| 322 | bf.mole_scale.Assign(info.mole_scale); | ||
| 323 | bf.mole_x.Assign(info.mole_x); | ||
| 324 | bf.mole_y.Assign(info.mole_y); | ||
| 325 | |||
| 326 | return {DefaultMiiName, bf, user_id}; | ||
| 327 | } | 104 | } |
| 328 | 105 | ||
| 329 | } // namespace | 106 | } // namespace |
| 330 | 107 | ||
| 331 | StoreData::StoreData() = default; | ||
| 332 | |||
| 333 | StoreData::StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, | ||
| 334 | const Common::UUID& user_id) { | ||
| 335 | core_data.name = name; | ||
| 336 | create_id = Common::UUID::MakeRandomRFC4122V4(); | ||
| 337 | |||
| 338 | core_data.data = bit_fields; | ||
| 339 | data_crc = MiiUtil::CalculateCrc16(&core_data.data, sizeof(core_data.data)); | ||
| 340 | device_crc = MiiUtil::CalculateCrc16(&user_id, sizeof(Common::UUID)); | ||
| 341 | } | ||
| 342 | |||
| 343 | MiiManager::MiiManager() : user_id{Service::Account::ProfileManager().GetLastOpenedUser()} {} | 108 | MiiManager::MiiManager() : user_id{Service::Account::ProfileManager().GetLastOpenedUser()} {} |
| 344 | 109 | ||
| 345 | bool MiiManager::CheckAndResetUpdateCounter(SourceFlag source_flag, u64& current_update_counter) { | 110 | bool MiiManager::CheckAndResetUpdateCounter(SourceFlag source_flag, u64& current_update_counter) { |
diff --git a/src/core/hle/service/mii/types/core_data.cpp b/src/core/hle/service/mii/types/core_data.cpp index a7b12ad8d..76c57fff2 100644 --- a/src/core/hle/service/mii/types/core_data.cpp +++ b/src/core/hle/service/mii/types/core_data.cpp | |||
| @@ -1,6 +1,601 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/mii/mii_util.h" | ||
| 4 | #include "core/hle/service/mii/types/core_data.h" | 5 | #include "core/hle/service/mii/types/core_data.h" |
| 6 | #include "core/hle/service/mii/types/raw_data.h" | ||
| 5 | 7 | ||
| 6 | namespace Service::Mii {} // namespace Service::Mii | 8 | namespace Service::Mii { |
| 9 | |||
| 10 | void CoreData::SetDefault() { | ||
| 11 | data = {}; | ||
| 12 | name = GetDefaultNickname(); | ||
| 13 | } | ||
| 14 | |||
| 15 | void CoreData::BuildRandom(Age age, Gender gender, Race race) { | ||
| 16 | if (gender == Gender::All) { | ||
| 17 | gender = MiiUtil::GetRandomValue<Gender>(Gender::Maximum); | ||
| 18 | } | ||
| 19 | |||
| 20 | data.gender.Assign(gender); | ||
| 21 | data.favorite_color.Assign(MiiUtil::GetRandomValue<u8>(11)); | ||
| 22 | data.region_move.Assign(0); | ||
| 23 | data.font_region.Assign(FontRegion::Standard); | ||
| 24 | data.type.Assign(0); | ||
| 25 | data.height.Assign(64); | ||
| 26 | data.build.Assign(64); | ||
| 27 | |||
| 28 | if (age == Age::All) { | ||
| 29 | const auto temp{MiiUtil::GetRandomValue<int>(10)}; | ||
| 30 | if (temp >= 8) { | ||
| 31 | age = Age::Old; | ||
| 32 | } else if (temp >= 4) { | ||
| 33 | age = Age::Normal; | ||
| 34 | } else { | ||
| 35 | age = Age::Young; | ||
| 36 | } | ||
| 37 | } | ||
| 38 | |||
| 39 | if (race == Race::All) { | ||
| 40 | const auto temp{MiiUtil::GetRandomValue<int>(10)}; | ||
| 41 | if (temp >= 8) { | ||
| 42 | race = Race::Black; | ||
| 43 | } else if (temp >= 4) { | ||
| 44 | race = Race::White; | ||
| 45 | } else { | ||
| 46 | race = Race::Asian; | ||
| 47 | } | ||
| 48 | } | ||
| 49 | |||
| 50 | u32 axis_y{}; | ||
| 51 | if (gender == Gender::Female && age == Age::Young) { | ||
| 52 | axis_y = MiiUtil::GetRandomValue<u32>(3); | ||
| 53 | } | ||
| 54 | |||
| 55 | const std::size_t index{3 * static_cast<std::size_t>(age) + | ||
| 56 | 9 * static_cast<std::size_t>(gender) + static_cast<std::size_t>(race)}; | ||
| 57 | |||
| 58 | const auto& faceline_type_info{RawData::RandomMiiFaceline.at(index)}; | ||
| 59 | const auto& faceline_color_info{RawData::RandomMiiFacelineColor.at( | ||
| 60 | 3 * static_cast<std::size_t>(gender) + static_cast<std::size_t>(race))}; | ||
| 61 | const auto& faceline_wrinkle_info{RawData::RandomMiiFacelineWrinkle.at(index)}; | ||
| 62 | const auto& faceline_makeup_info{RawData::RandomMiiFacelineMakeup.at(index)}; | ||
| 63 | const auto& hair_type_info{RawData::RandomMiiHairType.at(index)}; | ||
| 64 | const auto& hair_color_info{RawData::RandomMiiHairColor.at(3 * static_cast<std::size_t>(race) + | ||
| 65 | static_cast<std::size_t>(age))}; | ||
| 66 | const auto& eye_type_info{RawData::RandomMiiEyeType.at(index)}; | ||
| 67 | const auto& eye_color_info{RawData::RandomMiiEyeColor.at(static_cast<std::size_t>(race))}; | ||
| 68 | const auto& eyebrow_type_info{RawData::RandomMiiEyebrowType.at(index)}; | ||
| 69 | const auto& nose_type_info{RawData::RandomMiiNoseType.at(index)}; | ||
| 70 | const auto& mouth_type_info{RawData::RandomMiiMouthType.at(index)}; | ||
| 71 | const auto& glasses_type_info{RawData::RandomMiiGlassType.at(static_cast<std::size_t>(age))}; | ||
| 72 | |||
| 73 | data.faceline_type.Assign( | ||
| 74 | faceline_type_info | ||
| 75 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_type_info.values_count)]); | ||
| 76 | data.faceline_color.Assign( | ||
| 77 | faceline_color_info | ||
| 78 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_color_info.values_count)]); | ||
| 79 | data.faceline_wrinkle.Assign( | ||
| 80 | faceline_wrinkle_info | ||
| 81 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_wrinkle_info.values_count)]); | ||
| 82 | data.faceline_makeup.Assign( | ||
| 83 | faceline_makeup_info | ||
| 84 | .values[MiiUtil::GetRandomValue<std::size_t>(faceline_makeup_info.values_count)]); | ||
| 85 | |||
| 86 | data.hair_type.Assign( | ||
| 87 | hair_type_info.values[MiiUtil::GetRandomValue<std::size_t>(hair_type_info.values_count)]); | ||
| 88 | data.hair_color.Assign(RawData::GetHairColorFromVer3( | ||
| 89 | hair_color_info | ||
| 90 | .values[MiiUtil::GetRandomValue<std::size_t>(hair_color_info.values_count)])); | ||
| 91 | data.hair_flip.Assign(MiiUtil::GetRandomValue<HairFlip>(HairFlip::Maximum)); | ||
| 92 | |||
| 93 | data.eye_type.Assign( | ||
| 94 | eye_type_info.values[MiiUtil::GetRandomValue<std::size_t>(eye_type_info.values_count)]); | ||
| 95 | |||
| 96 | const auto eye_rotate_1{gender != Gender::Male ? 4 : 2}; | ||
| 97 | const auto eye_rotate_2{gender != Gender::Male ? 3 : 4}; | ||
| 98 | const auto eye_rotate_offset{32 - RawData::EyeRotateLookup[eye_rotate_1] + eye_rotate_2}; | ||
| 99 | const auto eye_rotate{32 - RawData::EyeRotateLookup[data.eye_type]}; | ||
| 100 | |||
| 101 | data.eye_color.Assign(RawData::GetEyeColorFromVer3( | ||
| 102 | eye_color_info.values[MiiUtil::GetRandomValue<std::size_t>(eye_color_info.values_count)])); | ||
| 103 | data.eye_scale.Assign(4); | ||
| 104 | data.eye_aspect.Assign(3); | ||
| 105 | data.eye_rotate.Assign(eye_rotate_offset - eye_rotate); | ||
| 106 | data.eye_x.Assign(2); | ||
| 107 | data.eye_y.Assign(axis_y + 12); | ||
| 108 | |||
| 109 | data.eyebrow_type.Assign( | ||
| 110 | eyebrow_type_info | ||
| 111 | .values[MiiUtil::GetRandomValue<std::size_t>(eyebrow_type_info.values_count)]); | ||
| 112 | |||
| 113 | const auto eyebrow_rotate_1{race == Race::Asian ? 6 : 0}; | ||
| 114 | const auto eyebrow_y{race == Race::Asian ? 9 : 10}; | ||
| 115 | const auto eyebrow_rotate_offset{32 - RawData::EyebrowRotateLookup[eyebrow_rotate_1] + 6}; | ||
| 116 | const auto eyebrow_rotate{ | ||
| 117 | 32 - RawData::EyebrowRotateLookup[static_cast<std::size_t>(data.eyebrow_type.Value())]}; | ||
| 118 | |||
| 119 | data.eyebrow_color.Assign(data.hair_color); | ||
| 120 | data.eyebrow_scale.Assign(4); | ||
| 121 | data.eyebrow_aspect.Assign(3); | ||
| 122 | data.eyebrow_rotate.Assign(eyebrow_rotate_offset - eyebrow_rotate); | ||
| 123 | data.eyebrow_x.Assign(2); | ||
| 124 | data.eyebrow_y.Assign(axis_y + eyebrow_y); | ||
| 125 | |||
| 126 | const auto nose_scale{gender == Gender::Female ? 3 : 4}; | ||
| 127 | |||
| 128 | data.nose_type.Assign( | ||
| 129 | nose_type_info.values[MiiUtil::GetRandomValue<std::size_t>(nose_type_info.values_count)]); | ||
| 130 | data.nose_scale.Assign(nose_scale); | ||
| 131 | data.nose_y.Assign(axis_y + 9); | ||
| 132 | |||
| 133 | const auto mouth_color{gender == Gender::Female ? MiiUtil::GetRandomValue<int>(4) : 0}; | ||
| 134 | |||
| 135 | data.mouth_type.Assign( | ||
| 136 | mouth_type_info.values[MiiUtil::GetRandomValue<std::size_t>(mouth_type_info.values_count)]); | ||
| 137 | data.mouth_color.Assign(RawData::GetMouthColorFromVer3(mouth_color)); | ||
| 138 | data.mouth_scale.Assign(4); | ||
| 139 | data.mouth_aspect.Assign(3); | ||
| 140 | data.mouth_y.Assign(axis_y + 13); | ||
| 141 | |||
| 142 | data.beard_color.Assign(data.hair_color); | ||
| 143 | data.mustache_scale.Assign(4); | ||
| 144 | |||
| 145 | if (gender == Gender::Male && age != Age::Young && MiiUtil::GetRandomValue<int>(10) < 2) { | ||
| 146 | const auto mustache_and_beard_flag{ | ||
| 147 | MiiUtil::GetRandomValue<BeardAndMustacheFlag>(BeardAndMustacheFlag::All)}; | ||
| 148 | |||
| 149 | auto beard_type{BeardType::None}; | ||
| 150 | auto mustache_type{MustacheType::None}; | ||
| 151 | |||
| 152 | if ((mustache_and_beard_flag & BeardAndMustacheFlag::Beard) == | ||
| 153 | BeardAndMustacheFlag::Beard) { | ||
| 154 | beard_type = MiiUtil::GetRandomValue<BeardType>(BeardType::Beard1, BeardType::Beard5); | ||
| 155 | } | ||
| 156 | |||
| 157 | if ((mustache_and_beard_flag & BeardAndMustacheFlag::Mustache) == | ||
| 158 | BeardAndMustacheFlag::Mustache) { | ||
| 159 | mustache_type = MiiUtil::GetRandomValue<MustacheType>(MustacheType::Mustache1, | ||
| 160 | MustacheType::Mustache5); | ||
| 161 | } | ||
| 162 | |||
| 163 | data.mustache_type.Assign(mustache_type); | ||
| 164 | data.beard_type.Assign(beard_type); | ||
| 165 | data.mustache_y.Assign(10); | ||
| 166 | } else { | ||
| 167 | data.mustache_type.Assign(MustacheType::None); | ||
| 168 | data.beard_type.Assign(BeardType::None); | ||
| 169 | data.mustache_y.Assign(axis_y + 10); | ||
| 170 | } | ||
| 171 | |||
| 172 | const auto glasses_type_start{MiiUtil::GetRandomValue<std::size_t>(100)}; | ||
| 173 | u8 glasses_type{}; | ||
| 174 | while (glasses_type_start < glasses_type_info.values[glasses_type]) { | ||
| 175 | if (++glasses_type >= glasses_type_info.values_count) { | ||
| 176 | ASSERT(false); | ||
| 177 | break; | ||
| 178 | } | ||
| 179 | } | ||
| 180 | |||
| 181 | data.glasses_type.Assign(glasses_type); | ||
| 182 | data.glasses_color.Assign(RawData::GetGlassColorFromVer3(0)); | ||
| 183 | data.glasses_scale.Assign(4); | ||
| 184 | data.glasses_y.Assign(axis_y + 10); | ||
| 185 | |||
| 186 | data.mole_type.Assign(0); | ||
| 187 | data.mole_scale.Assign(4); | ||
| 188 | data.mole_x.Assign(2); | ||
| 189 | data.mole_y.Assign(20); | ||
| 190 | } | ||
| 191 | |||
| 192 | u32 CoreData::IsValid() const { | ||
| 193 | // TODO: Complete this | ||
| 194 | return 0; | ||
| 195 | } | ||
| 196 | |||
| 197 | void CoreData::SetFontRegion(FontRegion value) { | ||
| 198 | data.font_region.Assign(value); | ||
| 199 | } | ||
| 200 | |||
| 201 | void CoreData::SetFavoriteColor(u8 value) { | ||
| 202 | data.favorite_color.Assign(value); | ||
| 203 | } | ||
| 204 | |||
| 205 | void CoreData::SetGender(Gender value) { | ||
| 206 | data.gender.Assign(value); | ||
| 207 | } | ||
| 208 | |||
| 209 | void CoreData::SetHeight(u8 value) { | ||
| 210 | data.height.Assign(value); | ||
| 211 | } | ||
| 212 | |||
| 213 | void CoreData::SetBuild(u8 value) { | ||
| 214 | data.build.Assign(value); | ||
| 215 | } | ||
| 216 | |||
| 217 | void CoreData::SetType(u8 value) { | ||
| 218 | data.type.Assign(value); | ||
| 219 | } | ||
| 220 | |||
| 221 | void CoreData::SetRegionMove(u8 value) { | ||
| 222 | data.region_move.Assign(value); | ||
| 223 | } | ||
| 224 | |||
| 225 | void CoreData::SetFacelineType(u8 value) { | ||
| 226 | data.faceline_type.Assign(value); | ||
| 227 | } | ||
| 228 | |||
| 229 | void CoreData::SetFacelineColor(u8 value) { | ||
| 230 | data.faceline_color.Assign(value); | ||
| 231 | } | ||
| 232 | |||
| 233 | void CoreData::SetFacelineWrinkle(u8 value) { | ||
| 234 | data.faceline_wrinkle.Assign(value); | ||
| 235 | } | ||
| 236 | |||
| 237 | void CoreData::SetFacelineMake(u8 value) { | ||
| 238 | data.faceline_makeup.Assign(value); | ||
| 239 | } | ||
| 240 | |||
| 241 | void CoreData::SetHairType(u8 value) { | ||
| 242 | data.hair_type.Assign(value); | ||
| 243 | } | ||
| 244 | |||
| 245 | void CoreData::SetHairColor(u8 value) { | ||
| 246 | data.hair_color.Assign(value); | ||
| 247 | } | ||
| 248 | |||
| 249 | void CoreData::SetHairFlip(HairFlip value) { | ||
| 250 | data.hair_flip.Assign(value); | ||
| 251 | } | ||
| 252 | |||
| 253 | void CoreData::SetEyeType(u8 value) { | ||
| 254 | data.eye_type.Assign(value); | ||
| 255 | } | ||
| 256 | |||
| 257 | void CoreData::SetEyeColor(u8 value) { | ||
| 258 | data.eye_color.Assign(value); | ||
| 259 | } | ||
| 260 | |||
| 261 | void CoreData::SetEyeScale(u8 value) { | ||
| 262 | data.eye_scale.Assign(value); | ||
| 263 | } | ||
| 264 | |||
| 265 | void CoreData::SetEyeAspect(u8 value) { | ||
| 266 | data.eye_aspect.Assign(value); | ||
| 267 | } | ||
| 268 | |||
| 269 | void CoreData::SetEyeRotate(u8 value) { | ||
| 270 | data.eye_rotate.Assign(value); | ||
| 271 | } | ||
| 272 | |||
| 273 | void CoreData::SetEyeX(u8 value) { | ||
| 274 | data.eye_x.Assign(value); | ||
| 275 | } | ||
| 276 | |||
| 277 | void CoreData::SetEyeY(u8 value) { | ||
| 278 | data.eye_y.Assign(value); | ||
| 279 | } | ||
| 280 | |||
| 281 | void CoreData::SetEyebrowType(u8 value) { | ||
| 282 | data.eyebrow_type.Assign(value); | ||
| 283 | } | ||
| 284 | |||
| 285 | void CoreData::SetEyebrowColor(u8 value) { | ||
| 286 | data.eyebrow_color.Assign(value); | ||
| 287 | } | ||
| 288 | |||
| 289 | void CoreData::SetEyebrowScale(u8 value) { | ||
| 290 | data.eyebrow_scale.Assign(value); | ||
| 291 | } | ||
| 292 | |||
| 293 | void CoreData::SetEyebrowAspect(u8 value) { | ||
| 294 | data.eyebrow_aspect.Assign(value); | ||
| 295 | } | ||
| 296 | |||
| 297 | void CoreData::SetEyebrowRotate(u8 value) { | ||
| 298 | data.eyebrow_rotate.Assign(value); | ||
| 299 | } | ||
| 300 | |||
| 301 | void CoreData::SetEyebrowX(u8 value) { | ||
| 302 | data.eyebrow_x.Assign(value); | ||
| 303 | } | ||
| 304 | |||
| 305 | void CoreData::SetEyebrowY(u8 value) { | ||
| 306 | data.eyebrow_y.Assign(value); | ||
| 307 | } | ||
| 308 | |||
| 309 | void CoreData::SetNoseType(u8 value) { | ||
| 310 | data.nose_type.Assign(value); | ||
| 311 | } | ||
| 312 | |||
| 313 | void CoreData::SetNoseScale(u8 value) { | ||
| 314 | data.nose_scale.Assign(value); | ||
| 315 | } | ||
| 316 | |||
| 317 | void CoreData::SetNoseY(u8 value) { | ||
| 318 | data.nose_y.Assign(value); | ||
| 319 | } | ||
| 320 | |||
| 321 | void CoreData::SetMouthType(u8 value) { | ||
| 322 | data.mouth_type.Assign(value); | ||
| 323 | } | ||
| 324 | |||
| 325 | void CoreData::SetMouthColor(u8 value) { | ||
| 326 | data.mouth_color.Assign(value); | ||
| 327 | } | ||
| 328 | |||
| 329 | void CoreData::SetMouthScale(u8 value) { | ||
| 330 | data.mouth_scale.Assign(value); | ||
| 331 | } | ||
| 332 | |||
| 333 | void CoreData::SetMouthAspect(u8 value) { | ||
| 334 | data.mouth_aspect.Assign(value); | ||
| 335 | } | ||
| 336 | |||
| 337 | void CoreData::SetMouthY(u8 value) { | ||
| 338 | data.mouth_y.Assign(value); | ||
| 339 | } | ||
| 340 | |||
| 341 | void CoreData::SetBeardColor(u8 value) { | ||
| 342 | data.beard_color.Assign(value); | ||
| 343 | } | ||
| 344 | |||
| 345 | void CoreData::SetBeardType(BeardType value) { | ||
| 346 | data.beard_type.Assign(value); | ||
| 347 | } | ||
| 348 | |||
| 349 | void CoreData::SetMustacheType(MustacheType value) { | ||
| 350 | data.mustache_type.Assign(value); | ||
| 351 | } | ||
| 352 | |||
| 353 | void CoreData::SetMustacheScale(u8 value) { | ||
| 354 | data.mustache_scale.Assign(value); | ||
| 355 | } | ||
| 356 | |||
| 357 | void CoreData::SetMustacheY(u8 value) { | ||
| 358 | data.mustache_y.Assign(value); | ||
| 359 | } | ||
| 360 | |||
| 361 | void CoreData::SetGlassType(u8 value) { | ||
| 362 | data.glasses_type.Assign(value); | ||
| 363 | } | ||
| 364 | |||
| 365 | void CoreData::SetGlassColor(u8 value) { | ||
| 366 | data.glasses_color.Assign(value); | ||
| 367 | } | ||
| 368 | |||
| 369 | void CoreData::SetGlassScale(u8 value) { | ||
| 370 | data.glasses_scale.Assign(value); | ||
| 371 | } | ||
| 372 | |||
| 373 | void CoreData::SetGlassY(u8 value) { | ||
| 374 | data.glasses_y.Assign(value); | ||
| 375 | } | ||
| 376 | |||
| 377 | void CoreData::SetMoleType(u8 value) { | ||
| 378 | data.mole_type.Assign(value); | ||
| 379 | } | ||
| 380 | |||
| 381 | void CoreData::SetMoleScale(u8 value) { | ||
| 382 | data.mole_scale.Assign(value); | ||
| 383 | } | ||
| 384 | |||
| 385 | void CoreData::SetMoleX(u8 value) { | ||
| 386 | data.mole_x.Assign(value); | ||
| 387 | } | ||
| 388 | |||
| 389 | void CoreData::SetMoleY(u8 value) { | ||
| 390 | data.mole_y.Assign(value); | ||
| 391 | } | ||
| 392 | |||
| 393 | void CoreData::SetNickname(Nickname nickname) { | ||
| 394 | name = nickname; | ||
| 395 | } | ||
| 396 | |||
| 397 | u8 CoreData::GetFavoriteColor() const { | ||
| 398 | return static_cast<u8>(data.favorite_color.Value()); | ||
| 399 | } | ||
| 400 | |||
| 401 | u8 CoreData::GetGender() const { | ||
| 402 | return static_cast<u8>(data.gender.Value()); | ||
| 403 | } | ||
| 404 | |||
| 405 | u8 CoreData::GetHeight() const { | ||
| 406 | return static_cast<u8>(data.height.Value()); | ||
| 407 | } | ||
| 408 | |||
| 409 | u8 CoreData::GetBuild() const { | ||
| 410 | return static_cast<u8>(data.build.Value()); | ||
| 411 | } | ||
| 412 | |||
| 413 | u8 CoreData::GetType() const { | ||
| 414 | return static_cast<u8>(data.type.Value()); | ||
| 415 | } | ||
| 416 | |||
| 417 | u8 CoreData::GetRegionMove() const { | ||
| 418 | return static_cast<u8>(data.region_move.Value()); | ||
| 419 | } | ||
| 420 | |||
| 421 | u8 CoreData::GetFacelineType() const { | ||
| 422 | return static_cast<u8>(data.faceline_type.Value()); | ||
| 423 | } | ||
| 424 | |||
| 425 | u8 CoreData::GetFacelineColor() const { | ||
| 426 | return static_cast<u8>(data.faceline_color.Value()); | ||
| 427 | } | ||
| 428 | |||
| 429 | u8 CoreData::GetFacelineWrinkle() const { | ||
| 430 | return static_cast<u8>(data.faceline_wrinkle.Value()); | ||
| 431 | } | ||
| 432 | |||
| 433 | u8 CoreData::GetFacelineMake() const { | ||
| 434 | return static_cast<u8>(data.faceline_makeup.Value()); | ||
| 435 | } | ||
| 436 | |||
| 437 | u8 CoreData::GetHairType() const { | ||
| 438 | return static_cast<u8>(data.hair_type.Value()); | ||
| 439 | } | ||
| 440 | |||
| 441 | u8 CoreData::GetHairColor() const { | ||
| 442 | return static_cast<u8>(data.hair_color.Value()); | ||
| 443 | } | ||
| 444 | |||
| 445 | u8 CoreData::GetHairFlip() const { | ||
| 446 | return static_cast<u8>(data.hair_flip.Value()); | ||
| 447 | } | ||
| 448 | |||
| 449 | u8 CoreData::GetEyeType() const { | ||
| 450 | return static_cast<u8>(data.eye_type.Value()); | ||
| 451 | } | ||
| 452 | |||
| 453 | u8 CoreData::GetEyeColor() const { | ||
| 454 | return static_cast<u8>(data.eye_color.Value()); | ||
| 455 | } | ||
| 456 | |||
| 457 | u8 CoreData::GetEyeScale() const { | ||
| 458 | return static_cast<u8>(data.eye_scale.Value()); | ||
| 459 | } | ||
| 460 | |||
| 461 | u8 CoreData::GetEyeAspect() const { | ||
| 462 | return static_cast<u8>(data.eye_aspect.Value()); | ||
| 463 | } | ||
| 464 | |||
| 465 | u8 CoreData::GetEyeRotate() const { | ||
| 466 | return static_cast<u8>(data.eye_rotate.Value()); | ||
| 467 | } | ||
| 468 | |||
| 469 | u8 CoreData::GetEyeX() const { | ||
| 470 | return static_cast<u8>(data.eye_x.Value()); | ||
| 471 | } | ||
| 472 | |||
| 473 | u8 CoreData::GetEyeY() const { | ||
| 474 | return static_cast<u8>(data.eye_y.Value()); | ||
| 475 | } | ||
| 476 | |||
| 477 | u8 CoreData::GetEyebrowType() const { | ||
| 478 | return static_cast<u8>(data.eyebrow_type.Value()); | ||
| 479 | } | ||
| 480 | |||
| 481 | u8 CoreData::GetEyebrowColor() const { | ||
| 482 | return static_cast<u8>(data.eyebrow_color.Value()); | ||
| 483 | } | ||
| 484 | |||
| 485 | u8 CoreData::GetEyebrowScale() const { | ||
| 486 | return static_cast<u8>(data.eyebrow_scale.Value()); | ||
| 487 | } | ||
| 488 | |||
| 489 | u8 CoreData::GetEyebrowAspect() const { | ||
| 490 | return static_cast<u8>(data.eyebrow_aspect.Value()); | ||
| 491 | } | ||
| 492 | |||
| 493 | u8 CoreData::GetEyebrowRotate() const { | ||
| 494 | return static_cast<u8>(data.eyebrow_rotate.Value()); | ||
| 495 | } | ||
| 496 | |||
| 497 | u8 CoreData::GetEyebrowX() const { | ||
| 498 | return static_cast<u8>(data.eyebrow_x.Value()); | ||
| 499 | } | ||
| 500 | |||
| 501 | u8 CoreData::GetEyebrowY() const { | ||
| 502 | return static_cast<u8>(data.eyebrow_y.Value()); | ||
| 503 | } | ||
| 504 | |||
| 505 | u8 CoreData::GetNoseType() const { | ||
| 506 | return static_cast<u8>(data.nose_type.Value()); | ||
| 507 | } | ||
| 508 | |||
| 509 | u8 CoreData::GetNoseScale() const { | ||
| 510 | return static_cast<u8>(data.nose_scale.Value()); | ||
| 511 | } | ||
| 512 | |||
| 513 | u8 CoreData::GetNoseY() const { | ||
| 514 | return static_cast<u8>(data.nose_y.Value()); | ||
| 515 | } | ||
| 516 | |||
| 517 | u8 CoreData::GetMouthType() const { | ||
| 518 | return static_cast<u8>(data.mouth_type.Value()); | ||
| 519 | } | ||
| 520 | |||
| 521 | u8 CoreData::GetMouthColor() const { | ||
| 522 | return static_cast<u8>(data.mouth_color.Value()); | ||
| 523 | } | ||
| 524 | |||
| 525 | u8 CoreData::GetMouthScale() const { | ||
| 526 | return static_cast<u8>(data.mouth_scale.Value()); | ||
| 527 | } | ||
| 528 | |||
| 529 | u8 CoreData::GetMouthAspect() const { | ||
| 530 | return static_cast<u8>(data.mouth_aspect.Value()); | ||
| 531 | } | ||
| 532 | |||
| 533 | u8 CoreData::GetMouthY() const { | ||
| 534 | return static_cast<u8>(data.mouth_y.Value()); | ||
| 535 | } | ||
| 536 | |||
| 537 | u8 CoreData::GetBeardColor() const { | ||
| 538 | return static_cast<u8>(data.beard_color.Value()); | ||
| 539 | } | ||
| 540 | |||
| 541 | u8 CoreData::GetBeardType() const { | ||
| 542 | return static_cast<u8>(data.beard_type.Value()); | ||
| 543 | } | ||
| 544 | |||
| 545 | u8 CoreData::GetMustacheType() const { | ||
| 546 | return static_cast<u8>(data.mustache_type.Value()); | ||
| 547 | } | ||
| 548 | |||
| 549 | u8 CoreData::GetMustacheScale() const { | ||
| 550 | return static_cast<u8>(data.mustache_scale.Value()); | ||
| 551 | } | ||
| 552 | |||
| 553 | u8 CoreData::GetMustacheY() const { | ||
| 554 | return static_cast<u8>(data.mustache_y.Value()); | ||
| 555 | } | ||
| 556 | |||
| 557 | u8 CoreData::GetGlassType() const { | ||
| 558 | return static_cast<u8>(data.glasses_type.Value()); | ||
| 559 | } | ||
| 560 | |||
| 561 | u8 CoreData::GetGlassColor() const { | ||
| 562 | return static_cast<u8>(data.glasses_color.Value()); | ||
| 563 | } | ||
| 564 | |||
| 565 | u8 CoreData::GetGlassScale() const { | ||
| 566 | return static_cast<u8>(data.glasses_scale.Value()); | ||
| 567 | } | ||
| 568 | |||
| 569 | u8 CoreData::GetGlassY() const { | ||
| 570 | return static_cast<u8>(data.glasses_y.Value()); | ||
| 571 | } | ||
| 572 | |||
| 573 | u8 CoreData::GetMoleType() const { | ||
| 574 | return static_cast<u8>(data.mole_type.Value()); | ||
| 575 | } | ||
| 576 | |||
| 577 | u8 CoreData::GetMoleScale() const { | ||
| 578 | return static_cast<u8>(data.mole_scale.Value()); | ||
| 579 | } | ||
| 580 | |||
| 581 | u8 CoreData::GetMoleX() const { | ||
| 582 | return static_cast<u8>(data.mole_x.Value()); | ||
| 583 | } | ||
| 584 | |||
| 585 | u8 CoreData::GetMoleY() const { | ||
| 586 | return static_cast<u8>(data.mole_y.Value()); | ||
| 587 | } | ||
| 588 | |||
| 589 | Nickname CoreData::GetNickname() const { | ||
| 590 | return name; | ||
| 591 | } | ||
| 592 | |||
| 593 | Nickname CoreData::GetDefaultNickname() const { | ||
| 594 | return {u'n', u'o', u' ', u'n', u'a', u'm', u'e'}; | ||
| 595 | } | ||
| 596 | |||
| 597 | Nickname CoreData::GetInvalidNickname() const { | ||
| 598 | return {u'?', u'?', u' ', u'?'}; | ||
| 599 | } | ||
| 600 | |||
| 601 | } // namespace Service::Mii | ||
diff --git a/src/core/hle/service/mii/types/core_data.h b/src/core/hle/service/mii/types/core_data.h index 9dd7a5380..76daf4e6e 100644 --- a/src/core/hle/service/mii/types/core_data.h +++ b/src/core/hle/service/mii/types/core_data.h | |||
| @@ -96,7 +96,116 @@ static_assert(sizeof(StoreDataBitFields) == 0x1c, "StoreDataBitFields has incorr | |||
| 96 | static_assert(std::is_trivially_copyable_v<StoreDataBitFields>, | 96 | static_assert(std::is_trivially_copyable_v<StoreDataBitFields>, |
| 97 | "StoreDataBitFields is not trivially copyable."); | 97 | "StoreDataBitFields is not trivially copyable."); |
| 98 | 98 | ||
| 99 | struct CoreData { | 99 | class CoreData { |
| 100 | public: | ||
| 101 | void SetDefault(); | ||
| 102 | void BuildRandom(Age age, Gender gender, Race race); | ||
| 103 | |||
| 104 | u32 IsValid() const; | ||
| 105 | |||
| 106 | void SetFontRegion(FontRegion value); | ||
| 107 | void SetFavoriteColor(u8 value); | ||
| 108 | void SetGender(Gender value); | ||
| 109 | void SetHeight(u8 value); | ||
| 110 | void SetBuild(u8 value); | ||
| 111 | void SetType(u8 value); | ||
| 112 | void SetRegionMove(u8 value); | ||
| 113 | void SetFacelineType(u8 value); | ||
| 114 | void SetFacelineColor(u8 value); | ||
| 115 | void SetFacelineWrinkle(u8 value); | ||
| 116 | void SetFacelineMake(u8 value); | ||
| 117 | void SetHairType(u8 value); | ||
| 118 | void SetHairColor(u8 value); | ||
| 119 | void SetHairFlip(HairFlip value); | ||
| 120 | void SetEyeType(u8 value); | ||
| 121 | void SetEyeColor(u8 value); | ||
| 122 | void SetEyeScale(u8 value); | ||
| 123 | void SetEyeAspect(u8 value); | ||
| 124 | void SetEyeRotate(u8 value); | ||
| 125 | void SetEyeX(u8 value); | ||
| 126 | void SetEyeY(u8 value); | ||
| 127 | void SetEyebrowType(u8 value); | ||
| 128 | void SetEyebrowColor(u8 value); | ||
| 129 | void SetEyebrowScale(u8 value); | ||
| 130 | void SetEyebrowAspect(u8 value); | ||
| 131 | void SetEyebrowRotate(u8 value); | ||
| 132 | void SetEyebrowX(u8 value); | ||
| 133 | void SetEyebrowY(u8 value); | ||
| 134 | void SetNoseType(u8 value); | ||
| 135 | void SetNoseScale(u8 value); | ||
| 136 | void SetNoseY(u8 value); | ||
| 137 | void SetMouthType(u8 value); | ||
| 138 | void SetMouthColor(u8 value); | ||
| 139 | void SetMouthScale(u8 value); | ||
| 140 | void SetMouthAspect(u8 value); | ||
| 141 | void SetMouthY(u8 value); | ||
| 142 | void SetBeardColor(u8 value); | ||
| 143 | void SetBeardType(BeardType value); | ||
| 144 | void SetMustacheType(MustacheType value); | ||
| 145 | void SetMustacheScale(u8 value); | ||
| 146 | void SetMustacheY(u8 value); | ||
| 147 | void SetGlassType(u8 value); | ||
| 148 | void SetGlassColor(u8 value); | ||
| 149 | void SetGlassScale(u8 value); | ||
| 150 | void SetGlassY(u8 value); | ||
| 151 | void SetMoleType(u8 value); | ||
| 152 | void SetMoleScale(u8 value); | ||
| 153 | void SetMoleX(u8 value); | ||
| 154 | void SetMoleY(u8 value); | ||
| 155 | void SetNickname(Nickname nickname); | ||
| 156 | |||
| 157 | u8 GetFavoriteColor() const; | ||
| 158 | u8 GetGender() const; | ||
| 159 | u8 GetHeight() const; | ||
| 160 | u8 GetBuild() const; | ||
| 161 | u8 GetType() const; | ||
| 162 | u8 GetRegionMove() const; | ||
| 163 | u8 GetFacelineType() const; | ||
| 164 | u8 GetFacelineColor() const; | ||
| 165 | u8 GetFacelineWrinkle() const; | ||
| 166 | u8 GetFacelineMake() const; | ||
| 167 | u8 GetHairType() const; | ||
| 168 | u8 GetHairColor() const; | ||
| 169 | u8 GetHairFlip() const; | ||
| 170 | u8 GetEyeType() const; | ||
| 171 | u8 GetEyeColor() const; | ||
| 172 | u8 GetEyeScale() const; | ||
| 173 | u8 GetEyeAspect() const; | ||
| 174 | u8 GetEyeRotate() const; | ||
| 175 | u8 GetEyeX() const; | ||
| 176 | u8 GetEyeY() const; | ||
| 177 | u8 GetEyebrowType() const; | ||
| 178 | u8 GetEyebrowColor() const; | ||
| 179 | u8 GetEyebrowScale() const; | ||
| 180 | u8 GetEyebrowAspect() const; | ||
| 181 | u8 GetEyebrowRotate() const; | ||
| 182 | u8 GetEyebrowX() const; | ||
| 183 | u8 GetEyebrowY() const; | ||
| 184 | u8 GetNoseType() const; | ||
| 185 | u8 GetNoseScale() const; | ||
| 186 | u8 GetNoseY() const; | ||
| 187 | u8 GetMouthType() const; | ||
| 188 | u8 GetMouthColor() const; | ||
| 189 | u8 GetMouthScale() const; | ||
| 190 | u8 GetMouthAspect() const; | ||
| 191 | u8 GetMouthY() const; | ||
| 192 | u8 GetBeardColor() const; | ||
| 193 | u8 GetBeardType() const; | ||
| 194 | u8 GetMustacheType() const; | ||
| 195 | u8 GetMustacheScale() const; | ||
| 196 | u8 GetMustacheY() const; | ||
| 197 | u8 GetGlassType() const; | ||
| 198 | u8 GetGlassColor() const; | ||
| 199 | u8 GetGlassScale() const; | ||
| 200 | u8 GetGlassY() const; | ||
| 201 | u8 GetMoleType() const; | ||
| 202 | u8 GetMoleScale() const; | ||
| 203 | u8 GetMoleX() const; | ||
| 204 | u8 GetMoleY() const; | ||
| 205 | Nickname GetNickname() const; | ||
| 206 | Nickname GetDefaultNickname() const; | ||
| 207 | Nickname GetInvalidNickname() const; | ||
| 208 | |||
| 100 | StoreDataBitFields data{}; | 209 | StoreDataBitFields data{}; |
| 101 | Nickname name{}; | 210 | Nickname name{}; |
| 102 | }; | 211 | }; |
diff --git a/src/core/hle/service/mii/types/store_data.cpp b/src/core/hle/service/mii/types/store_data.cpp index aadc0e1af..459e8699f 100644 --- a/src/core/hle/service/mii/types/store_data.cpp +++ b/src/core/hle/service/mii/types/store_data.cpp | |||
| @@ -1,6 +1,20 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project | 1 | // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | 3 | ||
| 4 | #include "core/hle/service/mii/mii_util.h" | ||
| 4 | #include "core/hle/service/mii/types/store_data.h" | 5 | #include "core/hle/service/mii/types/store_data.h" |
| 5 | 6 | ||
| 6 | namespace Service::Mii {} // namespace Service::Mii | 7 | namespace Service::Mii { |
| 8 | StoreData::StoreData() = default; | ||
| 9 | |||
| 10 | StoreData::StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, | ||
| 11 | const Common::UUID& user_id) { | ||
| 12 | core_data.name = name; | ||
| 13 | create_id = Common::UUID::MakeRandomRFC4122V4(); | ||
| 14 | |||
| 15 | core_data.data = bit_fields; | ||
| 16 | data_crc = MiiUtil::CalculateCrc16(&core_data.data, sizeof(core_data.data)); | ||
| 17 | device_crc = MiiUtil::CalculateCrc16(&user_id, sizeof(Common::UUID)); | ||
| 18 | } | ||
| 19 | |||
| 20 | } // namespace Service::Mii | ||
diff --git a/src/core/hle/service/mii/types/store_data.h b/src/core/hle/service/mii/types/store_data.h index 54a263b05..be6950967 100644 --- a/src/core/hle/service/mii/types/store_data.h +++ b/src/core/hle/service/mii/types/store_data.h | |||
| @@ -8,7 +8,8 @@ | |||
| 8 | 8 | ||
| 9 | namespace Service::Mii { | 9 | namespace Service::Mii { |
| 10 | 10 | ||
| 11 | struct StoreData { | 11 | class StoreData { |
| 12 | public: | ||
| 12 | StoreData(); | 13 | StoreData(); |
| 13 | StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, | 14 | StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, |
| 14 | const Common::UUID& user_id); | 15 | const Common::UUID& user_id); |