diff options
| author | 2023-09-10 23:07:00 -0600 | |
|---|---|---|
| committer | 2023-09-10 23:18:03 -0600 | |
| commit | d6037efe5e63d193ae8c586ff9d1e1326cae05cb (patch) | |
| tree | eea6b9067f3cd1fd0303ef081d8b97c7feb8d92a | |
| parent | service: mii: Move core data operations (diff) | |
| download | yuzu-d6037efe5e63d193ae8c586ff9d1e1326cae05cb.tar.gz yuzu-d6037efe5e63d193ae8c586ff9d1e1326cae05cb.tar.xz yuzu-d6037efe5e63d193ae8c586ff9d1e1326cae05cb.zip | |
service: mii: Move store data operations
Diffstat (limited to '')
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 70 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/core_data.cpp | 4 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/core_data.h | 1 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/store_data.cpp | 439 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types/store_data.h | 71 |
5 files changed, 512 insertions, 73 deletions
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 3483d95e5..dd7af531e 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -31,76 +31,22 @@ std::array<T, DestArraySize> ResizeArray(const std::array<T, SourceArraySize>& i | |||
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | CharInfo ConvertStoreDataToInfo(const StoreData& data) { | 33 | CharInfo ConvertStoreDataToInfo(const StoreData& data) { |
| 34 | const StoreDataBitFields& bf = data.core_data.data; | 34 | // Next Commit Will fix this one |
| 35 | 35 | return {}; | |
| 36 | return { | ||
| 37 | .create_id = data.create_id, | ||
| 38 | .name = data.core_data.name, | ||
| 39 | .font_region = static_cast<u8>(bf.font_region.Value()), | ||
| 40 | .favorite_color = static_cast<u8>(bf.favorite_color.Value()), | ||
| 41 | .gender = static_cast<u8>(bf.gender.Value()), | ||
| 42 | .height = static_cast<u8>(bf.height.Value()), | ||
| 43 | .build = static_cast<u8>(bf.build.Value()), | ||
| 44 | .type = static_cast<u8>(bf.type.Value()), | ||
| 45 | .region_move = static_cast<u8>(bf.region_move.Value()), | ||
| 46 | .faceline_type = static_cast<u8>(bf.faceline_type.Value()), | ||
| 47 | .faceline_color = static_cast<u8>(bf.faceline_color.Value()), | ||
| 48 | .faceline_wrinkle = static_cast<u8>(bf.faceline_wrinkle.Value()), | ||
| 49 | .faceline_make = static_cast<u8>(bf.faceline_makeup.Value()), | ||
| 50 | .hair_type = static_cast<u8>(bf.hair_type.Value()), | ||
| 51 | .hair_color = static_cast<u8>(bf.hair_color.Value()), | ||
| 52 | .hair_flip = static_cast<u8>(bf.hair_flip.Value()), | ||
| 53 | .eye_type = static_cast<u8>(bf.eye_type.Value()), | ||
| 54 | .eye_color = static_cast<u8>(bf.eye_color.Value()), | ||
| 55 | .eye_scale = static_cast<u8>(bf.eye_scale.Value()), | ||
| 56 | .eye_aspect = static_cast<u8>(bf.eye_aspect.Value()), | ||
| 57 | .eye_rotate = static_cast<u8>(bf.eye_rotate.Value()), | ||
| 58 | .eye_x = static_cast<u8>(bf.eye_x.Value()), | ||
| 59 | .eye_y = static_cast<u8>(bf.eye_y.Value()), | ||
| 60 | .eyebrow_type = static_cast<u8>(bf.eyebrow_type.Value()), | ||
| 61 | .eyebrow_color = static_cast<u8>(bf.eyebrow_color.Value()), | ||
| 62 | .eyebrow_scale = static_cast<u8>(bf.eyebrow_scale.Value()), | ||
| 63 | .eyebrow_aspect = static_cast<u8>(bf.eyebrow_aspect.Value()), | ||
| 64 | .eyebrow_rotate = static_cast<u8>(bf.eyebrow_rotate.Value()), | ||
| 65 | .eyebrow_x = static_cast<u8>(bf.eyebrow_x.Value()), | ||
| 66 | .eyebrow_y = static_cast<u8>(bf.eyebrow_y.Value() + 3), | ||
| 67 | .nose_type = static_cast<u8>(bf.nose_type.Value()), | ||
| 68 | .nose_scale = static_cast<u8>(bf.nose_scale.Value()), | ||
| 69 | .nose_y = static_cast<u8>(bf.nose_y.Value()), | ||
| 70 | .mouth_type = static_cast<u8>(bf.mouth_type.Value()), | ||
| 71 | .mouth_color = static_cast<u8>(bf.mouth_color.Value()), | ||
| 72 | .mouth_scale = static_cast<u8>(bf.mouth_scale.Value()), | ||
| 73 | .mouth_aspect = static_cast<u8>(bf.mouth_aspect.Value()), | ||
| 74 | .mouth_y = static_cast<u8>(bf.mouth_y.Value()), | ||
| 75 | .beard_color = static_cast<u8>(bf.beard_color.Value()), | ||
| 76 | .beard_type = static_cast<u8>(bf.beard_type.Value()), | ||
| 77 | .mustache_type = static_cast<u8>(bf.mustache_type.Value()), | ||
| 78 | .mustache_scale = static_cast<u8>(bf.mustache_scale.Value()), | ||
| 79 | .mustache_y = static_cast<u8>(bf.mustache_y.Value()), | ||
| 80 | .glasses_type = static_cast<u8>(bf.glasses_type.Value()), | ||
| 81 | .glasses_color = static_cast<u8>(bf.glasses_color.Value()), | ||
| 82 | .glasses_scale = static_cast<u8>(bf.glasses_scale.Value()), | ||
| 83 | .glasses_y = static_cast<u8>(bf.glasses_y.Value()), | ||
| 84 | .mole_type = static_cast<u8>(bf.mole_type.Value()), | ||
| 85 | .mole_scale = static_cast<u8>(bf.mole_scale.Value()), | ||
| 86 | .mole_x = static_cast<u8>(bf.mole_x.Value()), | ||
| 87 | .mole_y = static_cast<u8>(bf.mole_y.Value()), | ||
| 88 | .padding = 0, | ||
| 89 | }; | ||
| 90 | } | 36 | } |
| 91 | 37 | ||
| 92 | StoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { | 38 | StoreData BuildRandomStoreData(Age age, Gender gender, Race race, const Common::UUID& user_id) { |
| 93 | CoreData core_data{}; | 39 | StoreData store_data{}; |
| 94 | core_data.BuildRandom(age, gender, race); | 40 | store_data.BuildRandom(age, gender, race); |
| 95 | 41 | ||
| 96 | return {DefaultMiiName, core_data.data, user_id}; | 42 | return store_data; |
| 97 | } | 43 | } |
| 98 | 44 | ||
| 99 | StoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { | 45 | StoreData BuildDefaultStoreData(const DefaultMii& info, const Common::UUID& user_id) { |
| 100 | CoreData core_data{}; | 46 | StoreData store_data{}; |
| 101 | core_data.SetDefault(); | 47 | store_data.BuildDefault(0); |
| 102 | 48 | ||
| 103 | return {DefaultMiiName, core_data.data, user_id}; | 49 | return store_data; |
| 104 | } | 50 | } |
| 105 | 51 | ||
| 106 | } // namespace | 52 | } // namespace |
diff --git a/src/core/hle/service/mii/types/core_data.cpp b/src/core/hle/service/mii/types/core_data.cpp index 76c57fff2..9d7e604a9 100644 --- a/src/core/hle/service/mii/types/core_data.cpp +++ b/src/core/hle/service/mii/types/core_data.cpp | |||
| @@ -394,6 +394,10 @@ void CoreData::SetNickname(Nickname nickname) { | |||
| 394 | name = nickname; | 394 | name = nickname; |
| 395 | } | 395 | } |
| 396 | 396 | ||
| 397 | u8 CoreData::GetFontRegion() const { | ||
| 398 | return static_cast<u8>(data.font_region.Value()); | ||
| 399 | } | ||
| 400 | |||
| 397 | u8 CoreData::GetFavoriteColor() const { | 401 | u8 CoreData::GetFavoriteColor() const { |
| 398 | return static_cast<u8>(data.favorite_color.Value()); | 402 | return static_cast<u8>(data.favorite_color.Value()); |
| 399 | } | 403 | } |
diff --git a/src/core/hle/service/mii/types/core_data.h b/src/core/hle/service/mii/types/core_data.h index 76daf4e6e..411c123b3 100644 --- a/src/core/hle/service/mii/types/core_data.h +++ b/src/core/hle/service/mii/types/core_data.h | |||
| @@ -154,6 +154,7 @@ public: | |||
| 154 | void SetMoleY(u8 value); | 154 | void SetMoleY(u8 value); |
| 155 | void SetNickname(Nickname nickname); | 155 | void SetNickname(Nickname nickname); |
| 156 | 156 | ||
| 157 | u8 GetFontRegion() const; | ||
| 157 | u8 GetFavoriteColor() const; | 158 | u8 GetFavoriteColor() const; |
| 158 | u8 GetGender() const; | 159 | u8 GetGender() const; |
| 159 | u8 GetHeight() const; | 160 | u8 GetHeight() const; |
diff --git a/src/core/hle/service/mii/types/store_data.cpp b/src/core/hle/service/mii/types/store_data.cpp index 459e8699f..72c8fa2e9 100644 --- a/src/core/hle/service/mii/types/store_data.cpp +++ b/src/core/hle/service/mii/types/store_data.cpp | |||
| @@ -2,19 +2,442 @@ | |||
| 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/mii_util.h" |
| 5 | #include "core/hle/service/mii/types/raw_data.h" | ||
| 5 | #include "core/hle/service/mii/types/store_data.h" | 6 | #include "core/hle/service/mii/types/store_data.h" |
| 6 | 7 | ||
| 7 | namespace Service::Mii { | 8 | namespace Service::Mii { |
| 8 | StoreData::StoreData() = default; | ||
| 9 | 9 | ||
| 10 | StoreData::StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, | 10 | void StoreData::BuildDefault(u32 mii_index) { |
| 11 | const Common::UUID& user_id) { | 11 | const auto& default_mii = RawData::DefaultMii[mii_index]; |
| 12 | core_data.name = name; | 12 | core_data.SetDefault(); |
| 13 | create_id = Common::UUID::MakeRandomRFC4122V4(); | ||
| 14 | 13 | ||
| 15 | core_data.data = bit_fields; | 14 | core_data.SetFacelineType(static_cast<u8>(default_mii.face_type)); |
| 16 | data_crc = MiiUtil::CalculateCrc16(&core_data.data, sizeof(core_data.data)); | 15 | core_data.SetFacelineColor( |
| 17 | device_crc = MiiUtil::CalculateCrc16(&user_id, sizeof(Common::UUID)); | 16 | RawData::GetFacelineColorFromVer3(static_cast<u8>(default_mii.face_color))); |
| 17 | core_data.SetFacelineWrinkle(static_cast<u8>(default_mii.face_wrinkle)); | ||
| 18 | core_data.SetFacelineMake(static_cast<u8>(default_mii.face_makeup)); | ||
| 19 | |||
| 20 | core_data.SetHairType(static_cast<u8>(default_mii.hair_type)); | ||
| 21 | core_data.SetHairColor(RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.hair_color))); | ||
| 22 | core_data.SetHairFlip(default_mii.hair_flip); | ||
| 23 | core_data.SetEyeType(static_cast<u8>(default_mii.eye_type)); | ||
| 24 | core_data.SetEyeColor(RawData::GetEyeColorFromVer3(static_cast<u8>(default_mii.eye_color))); | ||
| 25 | core_data.SetEyeScale(static_cast<u8>(default_mii.eye_scale)); | ||
| 26 | core_data.SetEyeAspect(static_cast<u8>(default_mii.eye_aspect)); | ||
| 27 | core_data.SetEyeRotate(static_cast<u8>(default_mii.eye_rotate)); | ||
| 28 | core_data.SetEyeX(static_cast<u8>(default_mii.eye_x)); | ||
| 29 | core_data.SetEyeY(static_cast<u8>(default_mii.eye_y)); | ||
| 30 | |||
| 31 | core_data.SetEyebrowType(static_cast<u8>(default_mii.eyebrow_type)); | ||
| 32 | core_data.SetEyebrowColor( | ||
| 33 | RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.eyebrow_color))); | ||
| 34 | core_data.SetEyebrowScale(static_cast<u8>(default_mii.eyebrow_scale)); | ||
| 35 | core_data.SetEyebrowAspect(static_cast<u8>(default_mii.eyebrow_aspect)); | ||
| 36 | core_data.SetEyebrowRotate(static_cast<u8>(default_mii.eyebrow_rotate)); | ||
| 37 | core_data.SetEyebrowX(static_cast<u8>(default_mii.eyebrow_x)); | ||
| 38 | core_data.SetEyebrowY(static_cast<u8>(default_mii.eyebrow_y)); | ||
| 39 | |||
| 40 | core_data.SetNoseType(static_cast<u8>(default_mii.nose_type)); | ||
| 41 | core_data.SetNoseScale(static_cast<u8>(default_mii.nose_scale)); | ||
| 42 | core_data.SetNoseY(static_cast<u8>(default_mii.nose_y)); | ||
| 43 | |||
| 44 | core_data.SetMouthType(static_cast<u8>(default_mii.mouth_type)); | ||
| 45 | core_data.SetMouthColor( | ||
| 46 | RawData::GetMouthColorFromVer3(static_cast<u8>(default_mii.mouth_color))); | ||
| 47 | core_data.SetMouthScale(static_cast<u8>(default_mii.mouth_scale)); | ||
| 48 | core_data.SetMouthAspect(static_cast<u8>(default_mii.mouth_aspect)); | ||
| 49 | core_data.SetMouthY(static_cast<u8>(default_mii.mouth_y)); | ||
| 50 | |||
| 51 | core_data.SetMustacheType(default_mii.mustache_type); | ||
| 52 | core_data.SetBeardType(default_mii.beard_type); | ||
| 53 | core_data.SetBeardColor( | ||
| 54 | RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.beard_color))); | ||
| 55 | core_data.SetMustacheScale(static_cast<u8>(default_mii.mustache_scale)); | ||
| 56 | core_data.SetMustacheY(static_cast<u8>(default_mii.mustache_y)); | ||
| 57 | |||
| 58 | core_data.SetGlassType(static_cast<u8>(default_mii.glasses_type)); | ||
| 59 | core_data.SetGlassColor( | ||
| 60 | RawData::GetGlassColorFromVer3(static_cast<u8>(default_mii.glasses_color))); | ||
| 61 | core_data.SetGlassScale(static_cast<u8>(default_mii.glasses_scale)); | ||
| 62 | core_data.SetGlassY(static_cast<u8>(default_mii.glasses_y)); | ||
| 63 | |||
| 64 | core_data.SetMoleType(static_cast<u8>(default_mii.mole_type)); | ||
| 65 | core_data.SetMoleScale(static_cast<u8>(default_mii.mole_scale)); | ||
| 66 | core_data.SetMoleX(static_cast<u8>(default_mii.mole_x)); | ||
| 67 | core_data.SetMoleY(static_cast<u8>(default_mii.mole_y)); | ||
| 68 | |||
| 69 | core_data.SetHeight(static_cast<u8>(default_mii.height)); | ||
| 70 | core_data.SetBuild(static_cast<u8>(default_mii.weight)); | ||
| 71 | core_data.SetGender(default_mii.gender); | ||
| 72 | core_data.SetFavoriteColor(static_cast<u8>(default_mii.favorite_color)); | ||
| 73 | core_data.SetRegionMove(static_cast<u8>(default_mii.region_move)); | ||
| 74 | core_data.SetFontRegion(default_mii.font_region); | ||
| 75 | core_data.SetType(static_cast<u8>(default_mii.type)); | ||
| 76 | core_data.SetNickname(default_mii.nickname); | ||
| 77 | |||
| 78 | const auto device_id = MiiUtil::GetDeviceId(); | ||
| 79 | create_id = MiiUtil::MakeCreateId(); | ||
| 80 | device_crc = MiiUtil::CalculateCrc16(&device_id, sizeof(Common::UUID)); | ||
| 81 | data_crc = MiiUtil::CalculateCrc16(&core_data, sizeof(CoreData)); | ||
| 82 | } | ||
| 83 | |||
| 84 | void StoreData::BuildBase(Gender gender) { | ||
| 85 | const auto& default_mii = RawData::BaseMii[gender == Gender::Female ? 1 : 0]; | ||
| 86 | core_data.SetDefault(); | ||
| 87 | |||
| 88 | core_data.SetFacelineType(static_cast<u8>(default_mii.face_type)); | ||
| 89 | core_data.SetFacelineColor( | ||
| 90 | RawData::GetFacelineColorFromVer3(static_cast<u8>(default_mii.face_color))); | ||
| 91 | core_data.SetFacelineWrinkle(static_cast<u8>(default_mii.face_wrinkle)); | ||
| 92 | core_data.SetFacelineMake(static_cast<u8>(default_mii.face_makeup)); | ||
| 93 | |||
| 94 | core_data.SetHairType(static_cast<u8>(default_mii.hair_type)); | ||
| 95 | core_data.SetHairColor(RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.hair_color))); | ||
| 96 | core_data.SetHairFlip(default_mii.hair_flip); | ||
| 97 | core_data.SetEyeType(static_cast<u8>(default_mii.eye_type)); | ||
| 98 | core_data.SetEyeColor(RawData::GetEyeColorFromVer3(static_cast<u8>(default_mii.eye_color))); | ||
| 99 | core_data.SetEyeScale(static_cast<u8>(default_mii.eye_scale)); | ||
| 100 | core_data.SetEyeAspect(static_cast<u8>(default_mii.eye_aspect)); | ||
| 101 | core_data.SetEyeRotate(static_cast<u8>(default_mii.eye_rotate)); | ||
| 102 | core_data.SetEyeX(static_cast<u8>(default_mii.eye_x)); | ||
| 103 | core_data.SetEyeY(static_cast<u8>(default_mii.eye_y)); | ||
| 104 | |||
| 105 | core_data.SetEyebrowType(static_cast<u8>(default_mii.eyebrow_type)); | ||
| 106 | core_data.SetEyebrowColor( | ||
| 107 | RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.eyebrow_color))); | ||
| 108 | core_data.SetEyebrowScale(static_cast<u8>(default_mii.eyebrow_scale)); | ||
| 109 | core_data.SetEyebrowAspect(static_cast<u8>(default_mii.eyebrow_aspect)); | ||
| 110 | core_data.SetEyebrowRotate(static_cast<u8>(default_mii.eyebrow_rotate)); | ||
| 111 | core_data.SetEyebrowX(static_cast<u8>(default_mii.eyebrow_x)); | ||
| 112 | core_data.SetEyebrowY(static_cast<u8>(default_mii.eyebrow_y)); | ||
| 113 | |||
| 114 | core_data.SetNoseType(static_cast<u8>(default_mii.nose_type)); | ||
| 115 | core_data.SetNoseScale(static_cast<u8>(default_mii.nose_scale)); | ||
| 116 | core_data.SetNoseY(static_cast<u8>(default_mii.nose_y)); | ||
| 117 | |||
| 118 | core_data.SetMouthType(static_cast<u8>(default_mii.mouth_type)); | ||
| 119 | core_data.SetMouthColor( | ||
| 120 | RawData::GetMouthColorFromVer3(static_cast<u8>(default_mii.mouth_color))); | ||
| 121 | core_data.SetMouthScale(static_cast<u8>(default_mii.mouth_scale)); | ||
| 122 | core_data.SetMouthAspect(static_cast<u8>(default_mii.mouth_aspect)); | ||
| 123 | core_data.SetMouthY(static_cast<u8>(default_mii.mouth_y)); | ||
| 124 | |||
| 125 | core_data.SetMustacheType(default_mii.mustache_type); | ||
| 126 | core_data.SetBeardType(default_mii.beard_type); | ||
| 127 | core_data.SetBeardColor( | ||
| 128 | RawData::GetHairColorFromVer3(static_cast<u8>(default_mii.beard_color))); | ||
| 129 | core_data.SetMustacheScale(static_cast<u8>(default_mii.mustache_scale)); | ||
| 130 | core_data.SetMustacheY(static_cast<u8>(default_mii.mustache_y)); | ||
| 131 | |||
| 132 | core_data.SetGlassType(static_cast<u8>(default_mii.glasses_type)); | ||
| 133 | core_data.SetGlassColor( | ||
| 134 | RawData::GetGlassColorFromVer3(static_cast<u8>(default_mii.glasses_color))); | ||
| 135 | core_data.SetGlassScale(static_cast<u8>(default_mii.glasses_scale)); | ||
| 136 | core_data.SetGlassY(static_cast<u8>(default_mii.glasses_y)); | ||
| 137 | |||
| 138 | core_data.SetMoleType(static_cast<u8>(default_mii.mole_type)); | ||
| 139 | core_data.SetMoleScale(static_cast<u8>(default_mii.mole_scale)); | ||
| 140 | core_data.SetMoleX(static_cast<u8>(default_mii.mole_x)); | ||
| 141 | core_data.SetMoleY(static_cast<u8>(default_mii.mole_y)); | ||
| 142 | |||
| 143 | core_data.SetHeight(static_cast<u8>(default_mii.height)); | ||
| 144 | core_data.SetBuild(static_cast<u8>(default_mii.weight)); | ||
| 145 | core_data.SetGender(default_mii.gender); | ||
| 146 | core_data.SetFavoriteColor(static_cast<u8>(default_mii.favorite_color)); | ||
| 147 | core_data.SetRegionMove(static_cast<u8>(default_mii.region_move)); | ||
| 148 | core_data.SetFontRegion(default_mii.font_region); | ||
| 149 | core_data.SetType(static_cast<u8>(default_mii.type)); | ||
| 150 | core_data.SetNickname(default_mii.nickname); | ||
| 151 | |||
| 152 | const auto device_id = MiiUtil::GetDeviceId(); | ||
| 153 | create_id = MiiUtil::MakeCreateId(); | ||
| 154 | device_crc = MiiUtil::CalculateCrc16(&device_id, sizeof(Common::UUID)); | ||
| 155 | data_crc = MiiUtil::CalculateCrc16(&core_data, sizeof(CoreData)); | ||
| 156 | } | ||
| 157 | |||
| 158 | void StoreData::BuildRandom(Age age, Gender gender, Race race) { | ||
| 159 | core_data.BuildRandom(age, gender, race); | ||
| 160 | const auto device_id = MiiUtil::GetDeviceId(); | ||
| 161 | create_id = MiiUtil::MakeCreateId(); | ||
| 162 | device_crc = MiiUtil::CalculateCrc16(&device_id, sizeof(Common::UUID)); | ||
| 163 | data_crc = MiiUtil::CalculateCrc16(&core_data, sizeof(CoreData)); | ||
| 164 | } | ||
| 165 | |||
| 166 | void StoreData::SetInvalidName() { | ||
| 167 | const auto& invalid_name = core_data.GetInvalidNickname(); | ||
| 168 | const auto device_id = MiiUtil::GetDeviceId(); | ||
| 169 | core_data.SetNickname(invalid_name); | ||
| 170 | device_crc = MiiUtil::CalculateCrc16(&device_id, sizeof(Common::UUID)); | ||
| 171 | data_crc = MiiUtil::CalculateCrc16(&core_data, sizeof(CoreData)); | ||
| 172 | } | ||
| 173 | |||
| 174 | bool StoreData::IsSpecial() const { | ||
| 175 | return GetType() == 1; | ||
| 176 | } | ||
| 177 | |||
| 178 | u32 StoreData::IsValid() const { | ||
| 179 | // TODO: complete this | ||
| 180 | return 0; | ||
| 181 | } | ||
| 182 | |||
| 183 | Common::UUID StoreData::GetCreateId() const { | ||
| 184 | return create_id; | ||
| 185 | } | ||
| 186 | |||
| 187 | FontRegion StoreData::GetFontRegion() const { | ||
| 188 | return static_cast<FontRegion>(core_data.GetFontRegion()); | ||
| 189 | } | ||
| 190 | |||
| 191 | u8 StoreData::GetFavoriteColor() const { | ||
| 192 | return core_data.GetFavoriteColor(); | ||
| 193 | } | ||
| 194 | |||
| 195 | u8 StoreData::GetGender() const { | ||
| 196 | return core_data.GetGender(); | ||
| 197 | } | ||
| 198 | |||
| 199 | u8 StoreData::GetHeight() const { | ||
| 200 | return core_data.GetHeight(); | ||
| 201 | } | ||
| 202 | |||
| 203 | u8 StoreData::GetBuild() const { | ||
| 204 | return core_data.GetBuild(); | ||
| 205 | } | ||
| 206 | |||
| 207 | u8 StoreData::GetType() const { | ||
| 208 | return core_data.GetType(); | ||
| 209 | } | ||
| 210 | |||
| 211 | u8 StoreData::GetRegionMove() const { | ||
| 212 | return core_data.GetRegionMove(); | ||
| 213 | } | ||
| 214 | |||
| 215 | u8 StoreData::GetFacelineType() const { | ||
| 216 | return core_data.GetFacelineType(); | ||
| 217 | } | ||
| 218 | |||
| 219 | u8 StoreData::GetFacelineColor() const { | ||
| 220 | return core_data.GetFacelineColor(); | ||
| 221 | } | ||
| 222 | |||
| 223 | u8 StoreData::GetFacelineWrinkle() const { | ||
| 224 | return core_data.GetFacelineWrinkle(); | ||
| 225 | } | ||
| 226 | |||
| 227 | u8 StoreData::GetFacelineMake() const { | ||
| 228 | return core_data.GetFacelineMake(); | ||
| 229 | } | ||
| 230 | |||
| 231 | u8 StoreData::GetHairType() const { | ||
| 232 | return core_data.GetHairType(); | ||
| 233 | } | ||
| 234 | |||
| 235 | u8 StoreData::GetHairColor() const { | ||
| 236 | return core_data.GetHairColor(); | ||
| 237 | } | ||
| 238 | |||
| 239 | u8 StoreData::GetHairFlip() const { | ||
| 240 | return core_data.GetHairFlip(); | ||
| 241 | } | ||
| 242 | |||
| 243 | u8 StoreData::GetEyeType() const { | ||
| 244 | return core_data.GetEyeType(); | ||
| 245 | } | ||
| 246 | |||
| 247 | u8 StoreData::GetEyeColor() const { | ||
| 248 | return core_data.GetEyeColor(); | ||
| 249 | } | ||
| 250 | |||
| 251 | u8 StoreData::GetEyeScale() const { | ||
| 252 | return core_data.GetEyeScale(); | ||
| 253 | } | ||
| 254 | |||
| 255 | u8 StoreData::GetEyeAspect() const { | ||
| 256 | return core_data.GetEyeAspect(); | ||
| 257 | } | ||
| 258 | |||
| 259 | u8 StoreData::GetEyeRotate() const { | ||
| 260 | return core_data.GetEyeRotate(); | ||
| 261 | } | ||
| 262 | |||
| 263 | u8 StoreData::GetEyeX() const { | ||
| 264 | return core_data.GetEyeX(); | ||
| 265 | } | ||
| 266 | |||
| 267 | u8 StoreData::GetEyeY() const { | ||
| 268 | return core_data.GetEyeY(); | ||
| 269 | } | ||
| 270 | |||
| 271 | u8 StoreData::GetEyebrowType() const { | ||
| 272 | return core_data.GetEyebrowType(); | ||
| 273 | } | ||
| 274 | |||
| 275 | u8 StoreData::GetEyebrowColor() const { | ||
| 276 | return core_data.GetEyebrowColor(); | ||
| 277 | } | ||
| 278 | |||
| 279 | u8 StoreData::GetEyebrowScale() const { | ||
| 280 | return core_data.GetEyebrowScale(); | ||
| 281 | } | ||
| 282 | |||
| 283 | u8 StoreData::GetEyebrowAspect() const { | ||
| 284 | return core_data.GetEyebrowAspect(); | ||
| 285 | } | ||
| 286 | |||
| 287 | u8 StoreData::GetEyebrowRotate() const { | ||
| 288 | return core_data.GetEyebrowRotate(); | ||
| 289 | } | ||
| 290 | |||
| 291 | u8 StoreData::GetEyebrowX() const { | ||
| 292 | return core_data.GetEyebrowX(); | ||
| 293 | } | ||
| 294 | |||
| 295 | u8 StoreData::GetEyebrowY() const { | ||
| 296 | return core_data.GetEyebrowY(); | ||
| 297 | } | ||
| 298 | |||
| 299 | u8 StoreData::GetNoseType() const { | ||
| 300 | return core_data.GetNoseType(); | ||
| 301 | } | ||
| 302 | |||
| 303 | u8 StoreData::GetNoseScale() const { | ||
| 304 | return core_data.GetNoseScale(); | ||
| 305 | } | ||
| 306 | |||
| 307 | u8 StoreData::GetNoseY() const { | ||
| 308 | return core_data.GetNoseY(); | ||
| 309 | } | ||
| 310 | |||
| 311 | u8 StoreData::GetMouthType() const { | ||
| 312 | return core_data.GetMouthType(); | ||
| 313 | } | ||
| 314 | |||
| 315 | u8 StoreData::GetMouthColor() const { | ||
| 316 | return core_data.GetMouthColor(); | ||
| 317 | } | ||
| 318 | |||
| 319 | u8 StoreData::GetMouthScale() const { | ||
| 320 | return core_data.GetMouthScale(); | ||
| 321 | } | ||
| 322 | |||
| 323 | u8 StoreData::GetMouthAspect() const { | ||
| 324 | return core_data.GetMouthAspect(); | ||
| 325 | } | ||
| 326 | |||
| 327 | u8 StoreData::GetMouthY() const { | ||
| 328 | return core_data.GetMouthY(); | ||
| 329 | } | ||
| 330 | |||
| 331 | u8 StoreData::GetBeardColor() const { | ||
| 332 | return core_data.GetBeardColor(); | ||
| 333 | } | ||
| 334 | |||
| 335 | u8 StoreData::GetBeardType() const { | ||
| 336 | return core_data.GetBeardType(); | ||
| 337 | } | ||
| 338 | |||
| 339 | u8 StoreData::GetMustacheType() const { | ||
| 340 | return core_data.GetMustacheType(); | ||
| 341 | } | ||
| 342 | |||
| 343 | u8 StoreData::GetMustacheScale() const { | ||
| 344 | return core_data.GetMustacheScale(); | ||
| 345 | } | ||
| 346 | |||
| 347 | u8 StoreData::GetMustacheY() const { | ||
| 348 | return core_data.GetMustacheY(); | ||
| 349 | } | ||
| 350 | |||
| 351 | u8 StoreData::GetGlassType() const { | ||
| 352 | return core_data.GetGlassType(); | ||
| 353 | } | ||
| 354 | |||
| 355 | u8 StoreData::GetGlassColor() const { | ||
| 356 | return core_data.GetGlassColor(); | ||
| 357 | } | ||
| 358 | |||
| 359 | u8 StoreData::GetGlassScale() const { | ||
| 360 | return core_data.GetGlassScale(); | ||
| 361 | } | ||
| 362 | |||
| 363 | u8 StoreData::GetGlassY() const { | ||
| 364 | return core_data.GetGlassY(); | ||
| 365 | } | ||
| 366 | |||
| 367 | u8 StoreData::GetMoleType() const { | ||
| 368 | return core_data.GetMoleType(); | ||
| 369 | } | ||
| 370 | |||
| 371 | u8 StoreData::GetMoleScale() const { | ||
| 372 | return core_data.GetMoleScale(); | ||
| 373 | } | ||
| 374 | |||
| 375 | u8 StoreData::GetMoleX() const { | ||
| 376 | return core_data.GetMoleX(); | ||
| 377 | } | ||
| 378 | |||
| 379 | u8 StoreData::GetMoleY() const { | ||
| 380 | return core_data.GetMoleY(); | ||
| 381 | } | ||
| 382 | |||
| 383 | Nickname StoreData::GetNickname() const { | ||
| 384 | return core_data.GetNickname(); | ||
| 385 | } | ||
| 386 | |||
| 387 | bool StoreData::operator==(const StoreData& data) { | ||
| 388 | bool is_identical = data.core_data.IsValid() == 0; | ||
| 389 | is_identical &= core_data.GetNickname() == data.core_data.GetNickname(); | ||
| 390 | is_identical &= GetCreateId() == data.GetCreateId(); | ||
| 391 | is_identical &= GetFontRegion() == data.GetFontRegion(); | ||
| 392 | is_identical &= GetFavoriteColor() == data.GetFavoriteColor(); | ||
| 393 | is_identical &= GetGender() == data.GetGender(); | ||
| 394 | is_identical &= GetHeight() == data.GetHeight(); | ||
| 395 | is_identical &= GetBuild() == data.GetBuild(); | ||
| 396 | is_identical &= GetType() == data.GetType(); | ||
| 397 | is_identical &= GetRegionMove() == data.GetRegionMove(); | ||
| 398 | is_identical &= GetFacelineType() == data.GetFacelineType(); | ||
| 399 | is_identical &= GetFacelineColor() == data.GetFacelineColor(); | ||
| 400 | is_identical &= GetFacelineWrinkle() == data.GetFacelineWrinkle(); | ||
| 401 | is_identical &= GetFacelineMake() == data.GetFacelineMake(); | ||
| 402 | is_identical &= GetHairType() == data.GetHairType(); | ||
| 403 | is_identical &= GetHairColor() == data.GetHairColor(); | ||
| 404 | is_identical &= GetHairFlip() == data.GetHairFlip(); | ||
| 405 | is_identical &= GetEyeType() == data.GetEyeType(); | ||
| 406 | is_identical &= GetEyeColor() == data.GetEyeColor(); | ||
| 407 | is_identical &= GetEyeScale() == data.GetEyeScale(); | ||
| 408 | is_identical &= GetEyeAspect() == data.GetEyeAspect(); | ||
| 409 | is_identical &= GetEyeRotate() == data.GetEyeRotate(); | ||
| 410 | is_identical &= GetEyeX() == data.GetEyeX(); | ||
| 411 | is_identical &= GetEyeY() == data.GetEyeY(); | ||
| 412 | is_identical &= GetEyebrowType() == data.GetEyebrowType(); | ||
| 413 | is_identical &= GetEyebrowColor() == data.GetEyebrowColor(); | ||
| 414 | is_identical &= GetEyebrowScale() == data.GetEyebrowScale(); | ||
| 415 | is_identical &= GetEyebrowAspect() == data.GetEyebrowAspect(); | ||
| 416 | is_identical &= GetEyebrowRotate() == data.GetEyebrowRotate(); | ||
| 417 | is_identical &= GetEyebrowX() == data.GetEyebrowX(); | ||
| 418 | is_identical &= GetEyebrowY() == data.GetEyebrowY(); | ||
| 419 | is_identical &= GetNoseType() == data.GetNoseType(); | ||
| 420 | is_identical &= GetNoseScale() == data.GetNoseScale(); | ||
| 421 | is_identical &= GetNoseY() == data.GetNoseY(); | ||
| 422 | is_identical &= GetMouthType() == data.GetMouthType(); | ||
| 423 | is_identical &= GetMouthColor() == data.GetMouthColor(); | ||
| 424 | is_identical &= GetMouthScale() == data.GetMouthScale(); | ||
| 425 | is_identical &= GetMouthAspect() == data.GetMouthAspect(); | ||
| 426 | is_identical &= GetMouthY() == data.GetMouthY(); | ||
| 427 | is_identical &= GetBeardColor() == data.GetBeardColor(); | ||
| 428 | is_identical &= GetBeardType() == data.GetBeardType(); | ||
| 429 | is_identical &= GetMustacheType() == data.GetMustacheType(); | ||
| 430 | is_identical &= GetMustacheScale() == data.GetMustacheScale(); | ||
| 431 | is_identical &= GetMustacheY() == data.GetMustacheY(); | ||
| 432 | is_identical &= GetGlassType() == data.GetGlassType(); | ||
| 433 | is_identical &= GetGlassColor() == data.GetGlassColor(); | ||
| 434 | is_identical &= GetGlassScale() == data.GetGlassScale(); | ||
| 435 | is_identical &= GetGlassY() == data.GetGlassY(); | ||
| 436 | is_identical &= GetMoleType() == data.GetMoleType(); | ||
| 437 | is_identical &= GetMoleScale() == data.GetMoleScale(); | ||
| 438 | is_identical &= GetMoleX() == data.GetMoleX(); | ||
| 439 | is_identical &= data.GetMoleY() == data.GetMoleY(); | ||
| 440 | return is_identical; | ||
| 18 | } | 441 | } |
| 19 | 442 | ||
| 20 | } // namespace Service::Mii | 443 | } // 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 be6950967..cc8551a66 100644 --- a/src/core/hle/service/mii/types/store_data.h +++ b/src/core/hle/service/mii/types/store_data.h | |||
| @@ -10,10 +10,75 @@ namespace Service::Mii { | |||
| 10 | 10 | ||
| 11 | class StoreData { | 11 | class StoreData { |
| 12 | public: | 12 | public: |
| 13 | StoreData(); | 13 | // nn::mii::detail::StoreDataRaw::BuildDefault |
| 14 | StoreData(const Nickname& name, const StoreDataBitFields& bit_fields, | 14 | void BuildDefault(u32 mii_index); |
| 15 | const Common::UUID& user_id); | 15 | // nn::mii::detail::StoreDataRaw::BuildDefault |
| 16 | 16 | ||
| 17 | void BuildBase(Gender gender); | ||
| 18 | // nn::mii::detail::StoreDataRaw::BuildRandom | ||
| 19 | void BuildRandom(Age age, Gender gender, Race race); | ||
| 20 | |||
| 21 | void SetInvalidName(); | ||
| 22 | |||
| 23 | bool IsSpecial() const; | ||
| 24 | |||
| 25 | u32 IsValid() const; | ||
| 26 | |||
| 27 | Common::UUID GetCreateId() const; | ||
| 28 | FontRegion GetFontRegion() const; | ||
| 29 | u8 GetFavoriteColor() const; | ||
| 30 | u8 GetGender() const; | ||
| 31 | u8 GetHeight() const; | ||
| 32 | u8 GetBuild() const; | ||
| 33 | u8 GetType() const; | ||
| 34 | u8 GetRegionMove() const; | ||
| 35 | u8 GetFacelineType() const; | ||
| 36 | u8 GetFacelineColor() const; | ||
| 37 | u8 GetFacelineWrinkle() const; | ||
| 38 | u8 GetFacelineMake() const; | ||
| 39 | u8 GetHairType() const; | ||
| 40 | u8 GetHairColor() const; | ||
| 41 | u8 GetHairFlip() const; | ||
| 42 | u8 GetEyeType() const; | ||
| 43 | u8 GetEyeColor() const; | ||
| 44 | u8 GetEyeScale() const; | ||
| 45 | u8 GetEyeAspect() const; | ||
| 46 | u8 GetEyeRotate() const; | ||
| 47 | u8 GetEyeX() const; | ||
| 48 | u8 GetEyeY() const; | ||
| 49 | u8 GetEyebrowType() const; | ||
| 50 | u8 GetEyebrowColor() const; | ||
| 51 | u8 GetEyebrowScale() const; | ||
| 52 | u8 GetEyebrowAspect() const; | ||
| 53 | u8 GetEyebrowRotate() const; | ||
| 54 | u8 GetEyebrowX() const; | ||
| 55 | u8 GetEyebrowY() const; | ||
| 56 | u8 GetNoseType() const; | ||
| 57 | u8 GetNoseScale() const; | ||
| 58 | u8 GetNoseY() const; | ||
| 59 | u8 GetMouthType() const; | ||
| 60 | u8 GetMouthColor() const; | ||
| 61 | u8 GetMouthScale() const; | ||
| 62 | u8 GetMouthAspect() const; | ||
| 63 | u8 GetMouthY() const; | ||
| 64 | u8 GetBeardColor() const; | ||
| 65 | u8 GetBeardType() const; | ||
| 66 | u8 GetMustacheType() const; | ||
| 67 | u8 GetMustacheScale() const; | ||
| 68 | u8 GetMustacheY() const; | ||
| 69 | u8 GetGlassType() const; | ||
| 70 | u8 GetGlassColor() const; | ||
| 71 | u8 GetGlassScale() const; | ||
| 72 | u8 GetGlassY() const; | ||
| 73 | u8 GetMoleType() const; | ||
| 74 | u8 GetMoleScale() const; | ||
| 75 | u8 GetMoleX() const; | ||
| 76 | u8 GetMoleY() const; | ||
| 77 | Nickname GetNickname() const; | ||
| 78 | |||
| 79 | bool operator==(const StoreData& data); | ||
| 80 | |||
| 81 | private: | ||
| 17 | CoreData core_data{}; | 82 | CoreData core_data{}; |
| 18 | Common::UUID create_id{}; | 83 | Common::UUID create_id{}; |
| 19 | u16 data_crc{}; | 84 | u16 data_crc{}; |