diff options
| author | 2022-03-17 03:48:31 -0400 | |
|---|---|---|
| committer | 2022-03-21 23:57:31 -0400 | |
| commit | aa44ef7b64ad5b00a1e6da94d06fb6c3ecd82582 (patch) | |
| tree | 0ecc66cb856d215aafd7f18b94de553ffb3e400f /src | |
| parent | applets: Rename Mii to MiiEdit (diff) | |
| download | yuzu-aa44ef7b64ad5b00a1e6da94d06fb6c3ecd82582.tar.gz yuzu-aa44ef7b64ad5b00a1e6da94d06fb6c3ecd82582.tar.xz yuzu-aa44ef7b64ad5b00a1e6da94d06fb6c3ecd82582.zip | |
service: Move mii enums and structs into its own file
Moves these into types.h, since other files also make use of these types.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/frontend/applets/mii_edit.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.cpp | 3 | ||||
| -rw-r--r-- | src/core/hle/service/mii/mii_manager.h | 303 | ||||
| -rw-r--r-- | src/core/hle/service/mii/raw_data.h | 2 | ||||
| -rw-r--r-- | src/core/hle/service/mii/types.h | 307 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/service/nfp/nfp.h | 2 |
7 files changed, 312 insertions, 308 deletions
diff --git a/src/core/frontend/applets/mii_edit.h b/src/core/frontend/applets/mii_edit.h index 0d5bb69a2..247ccd461 100644 --- a/src/core/frontend/applets/mii_edit.h +++ b/src/core/frontend/applets/mii_edit.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | 8 | ||
| 9 | #include "core/hle/service/mii/mii_manager.h" | 9 | #include "core/hle/service/mii/types.h" |
| 10 | 10 | ||
| 11 | namespace Core::Frontend { | 11 | namespace Core::Frontend { |
| 12 | 12 | ||
diff --git a/src/core/hle/service/mii/mii_manager.cpp b/src/core/hle/service/mii/mii_manager.cpp index 0a57c3cde..188231615 100644 --- a/src/core/hle/service/mii/mii_manager.cpp +++ b/src/core/hle/service/mii/mii_manager.cpp | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| @@ -12,7 +12,6 @@ | |||
| 12 | #include "core/hle/service/acc/profile_manager.h" | 12 | #include "core/hle/service/acc/profile_manager.h" |
| 13 | #include "core/hle/service/mii/mii_manager.h" | 13 | #include "core/hle/service/mii/mii_manager.h" |
| 14 | #include "core/hle/service/mii/raw_data.h" | 14 | #include "core/hle/service/mii/raw_data.h" |
| 15 | #include "core/hle/service/mii/types.h" | ||
| 16 | 15 | ||
| 17 | namespace Service::Mii { | 16 | namespace Service::Mii { |
| 18 | 17 | ||
diff --git a/src/core/hle/service/mii/mii_manager.h b/src/core/hle/service/mii/mii_manager.h index 6999d15b1..5d134c425 100644 --- a/src/core/hle/service/mii/mii_manager.h +++ b/src/core/hle/service/mii/mii_manager.h | |||
| @@ -1,315 +1,16 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <vector> | 7 | #include <vector> |
| 9 | #include "common/bit_field.h" | 8 | |
| 10 | #include "common/common_funcs.h" | ||
| 11 | #include "common/uuid.h" | ||
| 12 | #include "core/hle/result.h" | 9 | #include "core/hle/result.h" |
| 13 | #include "core/hle/service/mii/types.h" | 10 | #include "core/hle/service/mii/types.h" |
| 14 | 11 | ||
| 15 | namespace Service::Mii { | 12 | namespace Service::Mii { |
| 16 | 13 | ||
| 17 | enum class Source : u32 { | ||
| 18 | Database = 0, | ||
| 19 | Default = 1, | ||
| 20 | Account = 2, | ||
| 21 | Friend = 3, | ||
| 22 | }; | ||
| 23 | |||
| 24 | enum class SourceFlag : u32 { | ||
| 25 | None = 0, | ||
| 26 | Database = 1 << 0, | ||
| 27 | Default = 1 << 1, | ||
| 28 | }; | ||
| 29 | DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); | ||
| 30 | |||
| 31 | struct MiiInfo { | ||
| 32 | Common::UUID uuid; | ||
| 33 | std::array<char16_t, 11> name; | ||
| 34 | u8 font_region; | ||
| 35 | u8 favorite_color; | ||
| 36 | u8 gender; | ||
| 37 | u8 height; | ||
| 38 | u8 build; | ||
| 39 | u8 type; | ||
| 40 | u8 region_move; | ||
| 41 | u8 faceline_type; | ||
| 42 | u8 faceline_color; | ||
| 43 | u8 faceline_wrinkle; | ||
| 44 | u8 faceline_make; | ||
| 45 | u8 hair_type; | ||
| 46 | u8 hair_color; | ||
| 47 | u8 hair_flip; | ||
| 48 | u8 eye_type; | ||
| 49 | u8 eye_color; | ||
| 50 | u8 eye_scale; | ||
| 51 | u8 eye_aspect; | ||
| 52 | u8 eye_rotate; | ||
| 53 | u8 eye_x; | ||
| 54 | u8 eye_y; | ||
| 55 | u8 eyebrow_type; | ||
| 56 | u8 eyebrow_color; | ||
| 57 | u8 eyebrow_scale; | ||
| 58 | u8 eyebrow_aspect; | ||
| 59 | u8 eyebrow_rotate; | ||
| 60 | u8 eyebrow_x; | ||
| 61 | u8 eyebrow_y; | ||
| 62 | u8 nose_type; | ||
| 63 | u8 nose_scale; | ||
| 64 | u8 nose_y; | ||
| 65 | u8 mouth_type; | ||
| 66 | u8 mouth_color; | ||
| 67 | u8 mouth_scale; | ||
| 68 | u8 mouth_aspect; | ||
| 69 | u8 mouth_y; | ||
| 70 | u8 beard_color; | ||
| 71 | u8 beard_type; | ||
| 72 | u8 mustache_type; | ||
| 73 | u8 mustache_scale; | ||
| 74 | u8 mustache_y; | ||
| 75 | u8 glasses_type; | ||
| 76 | u8 glasses_color; | ||
| 77 | u8 glasses_scale; | ||
| 78 | u8 glasses_y; | ||
| 79 | u8 mole_type; | ||
| 80 | u8 mole_scale; | ||
| 81 | u8 mole_x; | ||
| 82 | u8 mole_y; | ||
| 83 | u8 padding; | ||
| 84 | |||
| 85 | std::u16string Name() const; | ||
| 86 | }; | ||
| 87 | static_assert(sizeof(MiiInfo) == 0x58, "MiiInfo has incorrect size."); | ||
| 88 | static_assert(std::has_unique_object_representations_v<MiiInfo>, | ||
| 89 | "All bits of MiiInfo must contribute to its value."); | ||
| 90 | |||
| 91 | #pragma pack(push, 4) | ||
| 92 | |||
| 93 | struct MiiInfoElement { | ||
| 94 | MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {} | ||
| 95 | |||
| 96 | MiiInfo info{}; | ||
| 97 | Source source{}; | ||
| 98 | }; | ||
| 99 | static_assert(sizeof(MiiInfoElement) == 0x5c, "MiiInfoElement has incorrect size."); | ||
| 100 | |||
| 101 | struct MiiStoreBitFields { | ||
| 102 | union { | ||
| 103 | u32 word_0{}; | ||
| 104 | |||
| 105 | BitField<0, 8, u32> hair_type; | ||
| 106 | BitField<8, 7, u32> height; | ||
| 107 | BitField<15, 1, u32> mole_type; | ||
| 108 | BitField<16, 7, u32> build; | ||
| 109 | BitField<23, 1, HairFlip> hair_flip; | ||
| 110 | BitField<24, 7, u32> hair_color; | ||
| 111 | BitField<31, 1, u32> type; | ||
| 112 | }; | ||
| 113 | |||
| 114 | union { | ||
| 115 | u32 word_1{}; | ||
| 116 | |||
| 117 | BitField<0, 7, u32> eye_color; | ||
| 118 | BitField<7, 1, Gender> gender; | ||
| 119 | BitField<8, 7, u32> eyebrow_color; | ||
| 120 | BitField<16, 7, u32> mouth_color; | ||
| 121 | BitField<24, 7, u32> beard_color; | ||
| 122 | }; | ||
| 123 | |||
| 124 | union { | ||
| 125 | u32 word_2{}; | ||
| 126 | |||
| 127 | BitField<0, 7, u32> glasses_color; | ||
| 128 | BitField<8, 6, u32> eye_type; | ||
| 129 | BitField<14, 2, u32> region_move; | ||
| 130 | BitField<16, 6, u32> mouth_type; | ||
| 131 | BitField<22, 2, FontRegion> font_region; | ||
| 132 | BitField<24, 5, u32> eye_y; | ||
| 133 | BitField<29, 3, u32> glasses_scale; | ||
| 134 | }; | ||
| 135 | |||
| 136 | union { | ||
| 137 | u32 word_3{}; | ||
| 138 | |||
| 139 | BitField<0, 5, u32> eyebrow_type; | ||
| 140 | BitField<5, 3, MustacheType> mustache_type; | ||
| 141 | BitField<8, 5, u32> nose_type; | ||
| 142 | BitField<13, 3, BeardType> beard_type; | ||
| 143 | BitField<16, 5, u32> nose_y; | ||
| 144 | BitField<21, 3, u32> mouth_aspect; | ||
| 145 | BitField<24, 5, u32> mouth_y; | ||
| 146 | BitField<29, 3, u32> eyebrow_aspect; | ||
| 147 | }; | ||
| 148 | |||
| 149 | union { | ||
| 150 | u32 word_4{}; | ||
| 151 | |||
| 152 | BitField<0, 5, u32> mustache_y; | ||
| 153 | BitField<5, 3, u32> eye_rotate; | ||
| 154 | BitField<8, 5, u32> glasses_y; | ||
| 155 | BitField<13, 3, u32> eye_aspect; | ||
| 156 | BitField<16, 5, u32> mole_x; | ||
| 157 | BitField<21, 3, u32> eye_scale; | ||
| 158 | BitField<24, 5, u32> mole_y; | ||
| 159 | }; | ||
| 160 | |||
| 161 | union { | ||
| 162 | u32 word_5{}; | ||
| 163 | |||
| 164 | BitField<0, 5, u32> glasses_type; | ||
| 165 | BitField<8, 4, u32> favorite_color; | ||
| 166 | BitField<12, 4, u32> faceline_type; | ||
| 167 | BitField<16, 4, u32> faceline_color; | ||
| 168 | BitField<20, 4, u32> faceline_wrinkle; | ||
| 169 | BitField<24, 4, u32> faceline_makeup; | ||
| 170 | BitField<28, 4, u32> eye_x; | ||
| 171 | }; | ||
| 172 | |||
| 173 | union { | ||
| 174 | u32 word_6{}; | ||
| 175 | |||
| 176 | BitField<0, 4, u32> eyebrow_scale; | ||
| 177 | BitField<4, 4, u32> eyebrow_rotate; | ||
| 178 | BitField<8, 4, u32> eyebrow_x; | ||
| 179 | BitField<12, 4, u32> eyebrow_y; | ||
| 180 | BitField<16, 4, u32> nose_scale; | ||
| 181 | BitField<20, 4, u32> mouth_scale; | ||
| 182 | BitField<24, 4, u32> mustache_scale; | ||
| 183 | BitField<28, 4, u32> mole_scale; | ||
| 184 | }; | ||
| 185 | }; | ||
| 186 | static_assert(sizeof(MiiStoreBitFields) == 0x1c, "MiiStoreBitFields has incorrect size."); | ||
| 187 | static_assert(std::is_trivially_copyable_v<MiiStoreBitFields>, | ||
| 188 | "MiiStoreBitFields is not trivially copyable."); | ||
| 189 | |||
| 190 | struct MiiStoreData { | ||
| 191 | using Name = std::array<char16_t, 10>; | ||
| 192 | |||
| 193 | MiiStoreData(); | ||
| 194 | MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, | ||
| 195 | const Common::UUID& user_id); | ||
| 196 | |||
| 197 | // This corresponds to the above structure MiiStoreBitFields. I did it like this because the | ||
| 198 | // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is | ||
| 199 | // not suitable for our uses. | ||
| 200 | struct { | ||
| 201 | std::array<u8, 0x1C> data{}; | ||
| 202 | static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); | ||
| 203 | |||
| 204 | Name name{}; | ||
| 205 | Common::UUID uuid{}; | ||
| 206 | } data; | ||
| 207 | |||
| 208 | u16 data_crc{}; | ||
| 209 | u16 device_crc{}; | ||
| 210 | }; | ||
| 211 | static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size."); | ||
| 212 | |||
| 213 | struct MiiStoreDataElement { | ||
| 214 | MiiStoreData data{}; | ||
| 215 | Source source{}; | ||
| 216 | }; | ||
| 217 | static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size."); | ||
| 218 | |||
| 219 | struct MiiDatabase { | ||
| 220 | u32 magic{}; // 'NFDB' | ||
| 221 | std::array<MiiStoreData, 0x64> miis{}; | ||
| 222 | INSERT_PADDING_BYTES(1); | ||
| 223 | u8 count{}; | ||
| 224 | u16 crc{}; | ||
| 225 | }; | ||
| 226 | static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size."); | ||
| 227 | |||
| 228 | struct RandomMiiValues { | ||
| 229 | std::array<u8, 0xbc> values{}; | ||
| 230 | }; | ||
| 231 | static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size."); | ||
| 232 | |||
| 233 | struct RandomMiiData4 { | ||
| 234 | Gender gender{}; | ||
| 235 | Age age{}; | ||
| 236 | Race race{}; | ||
| 237 | u32 values_count{}; | ||
| 238 | std::array<u32, 47> values{}; | ||
| 239 | }; | ||
| 240 | static_assert(sizeof(RandomMiiData4) == 0xcc, "RandomMiiData4 has incorrect size."); | ||
| 241 | |||
| 242 | struct RandomMiiData3 { | ||
| 243 | u32 arg_1; | ||
| 244 | u32 arg_2; | ||
| 245 | u32 values_count; | ||
| 246 | std::array<u32, 47> values{}; | ||
| 247 | }; | ||
| 248 | static_assert(sizeof(RandomMiiData3) == 0xc8, "RandomMiiData3 has incorrect size."); | ||
| 249 | |||
| 250 | struct RandomMiiData2 { | ||
| 251 | u32 arg_1; | ||
| 252 | u32 values_count; | ||
| 253 | std::array<u32, 47> values{}; | ||
| 254 | }; | ||
| 255 | static_assert(sizeof(RandomMiiData2) == 0xc4, "RandomMiiData2 has incorrect size."); | ||
| 256 | |||
| 257 | struct DefaultMii { | ||
| 258 | u32 face_type{}; | ||
| 259 | u32 face_color{}; | ||
| 260 | u32 face_wrinkle{}; | ||
| 261 | u32 face_makeup{}; | ||
| 262 | u32 hair_type{}; | ||
| 263 | u32 hair_color{}; | ||
| 264 | u32 hair_flip{}; | ||
| 265 | u32 eye_type{}; | ||
| 266 | u32 eye_color{}; | ||
| 267 | u32 eye_scale{}; | ||
| 268 | u32 eye_aspect{}; | ||
| 269 | u32 eye_rotate{}; | ||
| 270 | u32 eye_x{}; | ||
| 271 | u32 eye_y{}; | ||
| 272 | u32 eyebrow_type{}; | ||
| 273 | u32 eyebrow_color{}; | ||
| 274 | u32 eyebrow_scale{}; | ||
| 275 | u32 eyebrow_aspect{}; | ||
| 276 | u32 eyebrow_rotate{}; | ||
| 277 | u32 eyebrow_x{}; | ||
| 278 | u32 eyebrow_y{}; | ||
| 279 | u32 nose_type{}; | ||
| 280 | u32 nose_scale{}; | ||
| 281 | u32 nose_y{}; | ||
| 282 | u32 mouth_type{}; | ||
| 283 | u32 mouth_color{}; | ||
| 284 | u32 mouth_scale{}; | ||
| 285 | u32 mouth_aspect{}; | ||
| 286 | u32 mouth_y{}; | ||
| 287 | u32 mustache_type{}; | ||
| 288 | u32 beard_type{}; | ||
| 289 | u32 beard_color{}; | ||
| 290 | u32 mustache_scale{}; | ||
| 291 | u32 mustache_y{}; | ||
| 292 | u32 glasses_type{}; | ||
| 293 | u32 glasses_color{}; | ||
| 294 | u32 glasses_scale{}; | ||
| 295 | u32 glasses_y{}; | ||
| 296 | u32 mole_type{}; | ||
| 297 | u32 mole_scale{}; | ||
| 298 | u32 mole_x{}; | ||
| 299 | u32 mole_y{}; | ||
| 300 | u32 height{}; | ||
| 301 | u32 weight{}; | ||
| 302 | Gender gender{}; | ||
| 303 | u32 favorite_color{}; | ||
| 304 | u32 region{}; | ||
| 305 | FontRegion font_region{}; | ||
| 306 | u32 type{}; | ||
| 307 | INSERT_PADDING_WORDS(5); | ||
| 308 | }; | ||
| 309 | static_assert(sizeof(DefaultMii) == 0xd8, "MiiStoreData has incorrect size."); | ||
| 310 | |||
| 311 | #pragma pack(pop) | ||
| 312 | |||
| 313 | // The Mii manager is responsible for loading and storing the Miis to the database in NAND along | 14 | // The Mii manager is responsible for loading and storing the Miis to the database in NAND along |
| 314 | // with providing an easy interface for HLE emulation of the mii service. | 15 | // with providing an easy interface for HLE emulation of the mii service. |
| 315 | class MiiManager { | 16 | class MiiManager { |
diff --git a/src/core/hle/service/mii/raw_data.h b/src/core/hle/service/mii/raw_data.h index bd90c2162..2e39c0d4f 100644 --- a/src/core/hle/service/mii/raw_data.h +++ b/src/core/hle/service/mii/raw_data.h | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | 6 | ||
| 7 | #include <array> | 7 | #include <array> |
| 8 | 8 | ||
| 9 | #include "core/hle/service/mii/mii_manager.h" | 9 | #include "core/hle/service/mii/types.h" |
| 10 | 10 | ||
| 11 | namespace Service::Mii::RawData { | 11 | namespace Service::Mii::RawData { |
| 12 | 12 | ||
diff --git a/src/core/hle/service/mii/types.h b/src/core/hle/service/mii/types.h index d65a1055e..5580b8c6a 100644 --- a/src/core/hle/service/mii/types.h +++ b/src/core/hle/service/mii/types.h | |||
| @@ -1,11 +1,16 @@ | |||
| 1 | // Copyright 2020 yuzu emulator team | 1 | // Copyright 2020 yuzu Emulator Project |
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include <array> | ||
| 8 | #include <type_traits> | ||
| 9 | |||
| 10 | #include "common/bit_field.h" | ||
| 7 | #include "common/common_funcs.h" | 11 | #include "common/common_funcs.h" |
| 8 | #include "common/common_types.h" | 12 | #include "common/common_types.h" |
| 13 | #include "common/uuid.h" | ||
| 9 | 14 | ||
| 10 | namespace Service::Mii { | 15 | namespace Service::Mii { |
| 11 | 16 | ||
| @@ -25,7 +30,11 @@ enum class BeardType : u32 { | |||
| 25 | Beard5, | 30 | Beard5, |
| 26 | }; | 31 | }; |
| 27 | 32 | ||
| 28 | enum class BeardAndMustacheFlag : u32 { Beard = 1, Mustache, All = Beard | Mustache }; | 33 | enum class BeardAndMustacheFlag : u32 { |
| 34 | Beard = 1, | ||
| 35 | Mustache, | ||
| 36 | All = Beard | Mustache, | ||
| 37 | }; | ||
| 29 | DECLARE_ENUM_FLAG_OPERATORS(BeardAndMustacheFlag); | 38 | DECLARE_ENUM_FLAG_OPERATORS(BeardAndMustacheFlag); |
| 30 | 39 | ||
| 31 | enum class FontRegion : u32 { | 40 | enum class FontRegion : u32 { |
| @@ -64,4 +73,298 @@ enum class Race : u32 { | |||
| 64 | All, | 73 | All, |
| 65 | }; | 74 | }; |
| 66 | 75 | ||
| 76 | enum class Source : u32 { | ||
| 77 | Database = 0, | ||
| 78 | Default = 1, | ||
| 79 | Account = 2, | ||
| 80 | Friend = 3, | ||
| 81 | }; | ||
| 82 | |||
| 83 | enum class SourceFlag : u32 { | ||
| 84 | None = 0, | ||
| 85 | Database = 1 << 0, | ||
| 86 | Default = 1 << 1, | ||
| 87 | }; | ||
| 88 | DECLARE_ENUM_FLAG_OPERATORS(SourceFlag); | ||
| 89 | |||
| 90 | struct MiiInfo { | ||
| 91 | Common::UUID uuid; | ||
| 92 | std::array<char16_t, 11> name; | ||
| 93 | u8 font_region; | ||
| 94 | u8 favorite_color; | ||
| 95 | u8 gender; | ||
| 96 | u8 height; | ||
| 97 | u8 build; | ||
| 98 | u8 type; | ||
| 99 | u8 region_move; | ||
| 100 | u8 faceline_type; | ||
| 101 | u8 faceline_color; | ||
| 102 | u8 faceline_wrinkle; | ||
| 103 | u8 faceline_make; | ||
| 104 | u8 hair_type; | ||
| 105 | u8 hair_color; | ||
| 106 | u8 hair_flip; | ||
| 107 | u8 eye_type; | ||
| 108 | u8 eye_color; | ||
| 109 | u8 eye_scale; | ||
| 110 | u8 eye_aspect; | ||
| 111 | u8 eye_rotate; | ||
| 112 | u8 eye_x; | ||
| 113 | u8 eye_y; | ||
| 114 | u8 eyebrow_type; | ||
| 115 | u8 eyebrow_color; | ||
| 116 | u8 eyebrow_scale; | ||
| 117 | u8 eyebrow_aspect; | ||
| 118 | u8 eyebrow_rotate; | ||
| 119 | u8 eyebrow_x; | ||
| 120 | u8 eyebrow_y; | ||
| 121 | u8 nose_type; | ||
| 122 | u8 nose_scale; | ||
| 123 | u8 nose_y; | ||
| 124 | u8 mouth_type; | ||
| 125 | u8 mouth_color; | ||
| 126 | u8 mouth_scale; | ||
| 127 | u8 mouth_aspect; | ||
| 128 | u8 mouth_y; | ||
| 129 | u8 beard_color; | ||
| 130 | u8 beard_type; | ||
| 131 | u8 mustache_type; | ||
| 132 | u8 mustache_scale; | ||
| 133 | u8 mustache_y; | ||
| 134 | u8 glasses_type; | ||
| 135 | u8 glasses_color; | ||
| 136 | u8 glasses_scale; | ||
| 137 | u8 glasses_y; | ||
| 138 | u8 mole_type; | ||
| 139 | u8 mole_scale; | ||
| 140 | u8 mole_x; | ||
| 141 | u8 mole_y; | ||
| 142 | u8 padding; | ||
| 143 | }; | ||
| 144 | static_assert(sizeof(MiiInfo) == 0x58, "MiiInfo has incorrect size."); | ||
| 145 | static_assert(std::has_unique_object_representations_v<MiiInfo>, | ||
| 146 | "All bits of MiiInfo must contribute to its value."); | ||
| 147 | |||
| 148 | #pragma pack(push, 4) | ||
| 149 | |||
| 150 | struct MiiInfoElement { | ||
| 151 | MiiInfoElement(const MiiInfo& info_, Source source_) : info{info_}, source{source_} {} | ||
| 152 | |||
| 153 | MiiInfo info{}; | ||
| 154 | Source source{}; | ||
| 155 | }; | ||
| 156 | static_assert(sizeof(MiiInfoElement) == 0x5c, "MiiInfoElement has incorrect size."); | ||
| 157 | |||
| 158 | struct MiiStoreBitFields { | ||
| 159 | union { | ||
| 160 | u32 word_0{}; | ||
| 161 | |||
| 162 | BitField<0, 8, u32> hair_type; | ||
| 163 | BitField<8, 7, u32> height; | ||
| 164 | BitField<15, 1, u32> mole_type; | ||
| 165 | BitField<16, 7, u32> build; | ||
| 166 | BitField<23, 1, HairFlip> hair_flip; | ||
| 167 | BitField<24, 7, u32> hair_color; | ||
| 168 | BitField<31, 1, u32> type; | ||
| 169 | }; | ||
| 170 | |||
| 171 | union { | ||
| 172 | u32 word_1{}; | ||
| 173 | |||
| 174 | BitField<0, 7, u32> eye_color; | ||
| 175 | BitField<7, 1, Gender> gender; | ||
| 176 | BitField<8, 7, u32> eyebrow_color; | ||
| 177 | BitField<16, 7, u32> mouth_color; | ||
| 178 | BitField<24, 7, u32> beard_color; | ||
| 179 | }; | ||
| 180 | |||
| 181 | union { | ||
| 182 | u32 word_2{}; | ||
| 183 | |||
| 184 | BitField<0, 7, u32> glasses_color; | ||
| 185 | BitField<8, 6, u32> eye_type; | ||
| 186 | BitField<14, 2, u32> region_move; | ||
| 187 | BitField<16, 6, u32> mouth_type; | ||
| 188 | BitField<22, 2, FontRegion> font_region; | ||
| 189 | BitField<24, 5, u32> eye_y; | ||
| 190 | BitField<29, 3, u32> glasses_scale; | ||
| 191 | }; | ||
| 192 | |||
| 193 | union { | ||
| 194 | u32 word_3{}; | ||
| 195 | |||
| 196 | BitField<0, 5, u32> eyebrow_type; | ||
| 197 | BitField<5, 3, MustacheType> mustache_type; | ||
| 198 | BitField<8, 5, u32> nose_type; | ||
| 199 | BitField<13, 3, BeardType> beard_type; | ||
| 200 | BitField<16, 5, u32> nose_y; | ||
| 201 | BitField<21, 3, u32> mouth_aspect; | ||
| 202 | BitField<24, 5, u32> mouth_y; | ||
| 203 | BitField<29, 3, u32> eyebrow_aspect; | ||
| 204 | }; | ||
| 205 | |||
| 206 | union { | ||
| 207 | u32 word_4{}; | ||
| 208 | |||
| 209 | BitField<0, 5, u32> mustache_y; | ||
| 210 | BitField<5, 3, u32> eye_rotate; | ||
| 211 | BitField<8, 5, u32> glasses_y; | ||
| 212 | BitField<13, 3, u32> eye_aspect; | ||
| 213 | BitField<16, 5, u32> mole_x; | ||
| 214 | BitField<21, 3, u32> eye_scale; | ||
| 215 | BitField<24, 5, u32> mole_y; | ||
| 216 | }; | ||
| 217 | |||
| 218 | union { | ||
| 219 | u32 word_5{}; | ||
| 220 | |||
| 221 | BitField<0, 5, u32> glasses_type; | ||
| 222 | BitField<8, 4, u32> favorite_color; | ||
| 223 | BitField<12, 4, u32> faceline_type; | ||
| 224 | BitField<16, 4, u32> faceline_color; | ||
| 225 | BitField<20, 4, u32> faceline_wrinkle; | ||
| 226 | BitField<24, 4, u32> faceline_makeup; | ||
| 227 | BitField<28, 4, u32> eye_x; | ||
| 228 | }; | ||
| 229 | |||
| 230 | union { | ||
| 231 | u32 word_6{}; | ||
| 232 | |||
| 233 | BitField<0, 4, u32> eyebrow_scale; | ||
| 234 | BitField<4, 4, u32> eyebrow_rotate; | ||
| 235 | BitField<8, 4, u32> eyebrow_x; | ||
| 236 | BitField<12, 4, u32> eyebrow_y; | ||
| 237 | BitField<16, 4, u32> nose_scale; | ||
| 238 | BitField<20, 4, u32> mouth_scale; | ||
| 239 | BitField<24, 4, u32> mustache_scale; | ||
| 240 | BitField<28, 4, u32> mole_scale; | ||
| 241 | }; | ||
| 242 | }; | ||
| 243 | static_assert(sizeof(MiiStoreBitFields) == 0x1c, "MiiStoreBitFields has incorrect size."); | ||
| 244 | static_assert(std::is_trivially_copyable_v<MiiStoreBitFields>, | ||
| 245 | "MiiStoreBitFields is not trivially copyable."); | ||
| 246 | |||
| 247 | struct MiiStoreData { | ||
| 248 | using Name = std::array<char16_t, 10>; | ||
| 249 | |||
| 250 | MiiStoreData(); | ||
| 251 | MiiStoreData(const Name& name, const MiiStoreBitFields& bit_fields, | ||
| 252 | const Common::UUID& user_id); | ||
| 253 | |||
| 254 | // This corresponds to the above structure MiiStoreBitFields. I did it like this because the | ||
| 255 | // BitField<> type makes this (and any thing that contains it) not trivially copyable, which is | ||
| 256 | // not suitable for our uses. | ||
| 257 | struct { | ||
| 258 | std::array<u8, 0x1C> data{}; | ||
| 259 | static_assert(sizeof(MiiStoreBitFields) == sizeof(data), "data field has incorrect size."); | ||
| 260 | |||
| 261 | Name name{}; | ||
| 262 | Common::UUID uuid{}; | ||
| 263 | } data; | ||
| 264 | |||
| 265 | u16 data_crc{}; | ||
| 266 | u16 device_crc{}; | ||
| 267 | }; | ||
| 268 | static_assert(sizeof(MiiStoreData) == 0x44, "MiiStoreData has incorrect size."); | ||
| 269 | |||
| 270 | struct MiiStoreDataElement { | ||
| 271 | MiiStoreData data{}; | ||
| 272 | Source source{}; | ||
| 273 | }; | ||
| 274 | static_assert(sizeof(MiiStoreDataElement) == 0x48, "MiiStoreDataElement has incorrect size."); | ||
| 275 | |||
| 276 | struct MiiDatabase { | ||
| 277 | u32 magic{}; // 'NFDB' | ||
| 278 | std::array<MiiStoreData, 0x64> miis{}; | ||
| 279 | INSERT_PADDING_BYTES(1); | ||
| 280 | u8 count{}; | ||
| 281 | u16 crc{}; | ||
| 282 | }; | ||
| 283 | static_assert(sizeof(MiiDatabase) == 0x1A98, "MiiDatabase has incorrect size."); | ||
| 284 | |||
| 285 | struct RandomMiiValues { | ||
| 286 | std::array<u8, 0xbc> values{}; | ||
| 287 | }; | ||
| 288 | static_assert(sizeof(RandomMiiValues) == 0xbc, "RandomMiiValues has incorrect size."); | ||
| 289 | |||
| 290 | struct RandomMiiData4 { | ||
| 291 | Gender gender{}; | ||
| 292 | Age age{}; | ||
| 293 | Race race{}; | ||
| 294 | u32 values_count{}; | ||
| 295 | std::array<u32, 47> values{}; | ||
| 296 | }; | ||
| 297 | static_assert(sizeof(RandomMiiData4) == 0xcc, "RandomMiiData4 has incorrect size."); | ||
| 298 | |||
| 299 | struct RandomMiiData3 { | ||
| 300 | u32 arg_1; | ||
| 301 | u32 arg_2; | ||
| 302 | u32 values_count; | ||
| 303 | std::array<u32, 47> values{}; | ||
| 304 | }; | ||
| 305 | static_assert(sizeof(RandomMiiData3) == 0xc8, "RandomMiiData3 has incorrect size."); | ||
| 306 | |||
| 307 | struct RandomMiiData2 { | ||
| 308 | u32 arg_1; | ||
| 309 | u32 values_count; | ||
| 310 | std::array<u32, 47> values{}; | ||
| 311 | }; | ||
| 312 | static_assert(sizeof(RandomMiiData2) == 0xc4, "RandomMiiData2 has incorrect size."); | ||
| 313 | |||
| 314 | struct DefaultMii { | ||
| 315 | u32 face_type{}; | ||
| 316 | u32 face_color{}; | ||
| 317 | u32 face_wrinkle{}; | ||
| 318 | u32 face_makeup{}; | ||
| 319 | u32 hair_type{}; | ||
| 320 | u32 hair_color{}; | ||
| 321 | u32 hair_flip{}; | ||
| 322 | u32 eye_type{}; | ||
| 323 | u32 eye_color{}; | ||
| 324 | u32 eye_scale{}; | ||
| 325 | u32 eye_aspect{}; | ||
| 326 | u32 eye_rotate{}; | ||
| 327 | u32 eye_x{}; | ||
| 328 | u32 eye_y{}; | ||
| 329 | u32 eyebrow_type{}; | ||
| 330 | u32 eyebrow_color{}; | ||
| 331 | u32 eyebrow_scale{}; | ||
| 332 | u32 eyebrow_aspect{}; | ||
| 333 | u32 eyebrow_rotate{}; | ||
| 334 | u32 eyebrow_x{}; | ||
| 335 | u32 eyebrow_y{}; | ||
| 336 | u32 nose_type{}; | ||
| 337 | u32 nose_scale{}; | ||
| 338 | u32 nose_y{}; | ||
| 339 | u32 mouth_type{}; | ||
| 340 | u32 mouth_color{}; | ||
| 341 | u32 mouth_scale{}; | ||
| 342 | u32 mouth_aspect{}; | ||
| 343 | u32 mouth_y{}; | ||
| 344 | u32 mustache_type{}; | ||
| 345 | u32 beard_type{}; | ||
| 346 | u32 beard_color{}; | ||
| 347 | u32 mustache_scale{}; | ||
| 348 | u32 mustache_y{}; | ||
| 349 | u32 glasses_type{}; | ||
| 350 | u32 glasses_color{}; | ||
| 351 | u32 glasses_scale{}; | ||
| 352 | u32 glasses_y{}; | ||
| 353 | u32 mole_type{}; | ||
| 354 | u32 mole_scale{}; | ||
| 355 | u32 mole_x{}; | ||
| 356 | u32 mole_y{}; | ||
| 357 | u32 height{}; | ||
| 358 | u32 weight{}; | ||
| 359 | Gender gender{}; | ||
| 360 | u32 favorite_color{}; | ||
| 361 | u32 region{}; | ||
| 362 | FontRegion font_region{}; | ||
| 363 | u32 type{}; | ||
| 364 | INSERT_PADDING_WORDS(5); | ||
| 365 | }; | ||
| 366 | static_assert(sizeof(DefaultMii) == 0xd8, "MiiStoreData has incorrect size."); | ||
| 367 | |||
| 368 | #pragma pack(pop) | ||
| 369 | |||
| 67 | } // namespace Service::Mii | 370 | } // namespace Service::Mii |
diff --git a/src/core/hle/service/nfp/nfp.cpp b/src/core/hle/service/nfp/nfp.cpp index 513107715..dab99b675 100644 --- a/src/core/hle/service/nfp/nfp.cpp +++ b/src/core/hle/service/nfp/nfp.cpp | |||
| @@ -12,6 +12,7 @@ | |||
| 12 | #include "core/hid/hid_types.h" | 12 | #include "core/hid/hid_types.h" |
| 13 | #include "core/hle/ipc_helpers.h" | 13 | #include "core/hle/ipc_helpers.h" |
| 14 | #include "core/hle/kernel/k_event.h" | 14 | #include "core/hle/kernel/k_event.h" |
| 15 | #include "core/hle/service/mii/mii_manager.h" | ||
| 15 | #include "core/hle/service/nfp/nfp.h" | 16 | #include "core/hle/service/nfp/nfp.h" |
| 16 | #include "core/hle/service/nfp/nfp_user.h" | 17 | #include "core/hle/service/nfp/nfp_user.h" |
| 17 | 18 | ||
diff --git a/src/core/hle/service/nfp/nfp.h b/src/core/hle/service/nfp/nfp.h index 022f13b29..ab652f635 100644 --- a/src/core/hle/service/nfp/nfp.h +++ b/src/core/hle/service/nfp/nfp.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | #include "common/common_funcs.h" | 10 | #include "common/common_funcs.h" |
| 11 | #include "core/hle/service/kernel_helpers.h" | 11 | #include "core/hle/service/kernel_helpers.h" |
| 12 | #include "core/hle/service/mii/mii_manager.h" | 12 | #include "core/hle/service/mii/types.h" |
| 13 | #include "core/hle/service/service.h" | 13 | #include "core/hle/service/service.h" |
| 14 | 14 | ||
| 15 | namespace Kernel { | 15 | namespace Kernel { |