Skip to content

Commit ee012e5

Browse files
ZeroSkill1fincs
authored andcommitted
fix up Mii struct
1 parent b6c482c commit ee012e5

File tree

1 file changed

+53
-40
lines changed

1 file changed

+53
-40
lines changed

libctru/include/3ds/mii.h

Lines changed: 53 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,16 @@
66
*/
77
#pragma once
88

9+
#define MII_NAME_LEN 10+1 ///< 10-character NULL-terminated UTF-16 mii name
10+
11+
typedef u16 MiiScreenName[MII_NAME_LEN];
12+
913
#include <3ds/types.h>
1014

11-
/// Shared Mii struct
15+
/// Shared Base Mii struct
1216
typedef struct
1317
{
14-
u8 magic; ///< Always 3?
18+
u8 version; ///< Always 3
1519

1620
/// Mii options
1721
struct
@@ -20,6 +24,7 @@ typedef struct
2024
bool is_private_name : 1; ///< Private name?
2125
u8 region_lock : 2; ///< Region lock (0=no lock, 1=JPN, 2=USA, 3=EUR)
2226
u8 char_set : 2; ///< Character set (0=JPN+USA+EUR, 1=CHN, 2=KOR, 3=TWN)
27+
u8 _pad : 2;
2328
} mii_options;
2429

2530
/// Mii position in Mii selector or Mii maker
@@ -34,6 +39,7 @@ typedef struct
3439
{
3540
u8 unknown0 : 4; ///< Mabye padding (always seems to be 0)?
3641
u8 origin_console : 3; ///< Console that the Mii was created on (1=WII, 2=DSI, 3=3DS)
42+
u8 _pad : 1;
3743
} console_identity;
3844

3945
u64 system_id; ///< Identifies the system that the Mii was created on (Determines pants)
@@ -47,8 +53,9 @@ typedef struct
4753
u16 bday_month : 4; ///< Month of Mii's birthday
4854
u16 bday_day : 5; ///< Day of Mii's birthday
4955
u16 shirt_color : 4; ///< Color of Mii's shirt
50-
bool favorite : 1; ///< Whether the Mii is one of your 10 favorite Mii's
51-
} mii_details;
56+
u16 favorite : 1; ///< Whether the Mii is one of your 10 favorite Mii's
57+
u16 _pad : 1;
58+
} CTR_PACKED mii_details;
5259

5360
u16 mii_name[10]; ///< Name of Mii (Encoded using UTF16)
5461
u8 height; ///< How tall the Mii is
@@ -57,59 +64,63 @@ typedef struct
5764
/// Face style
5865
struct
5966
{
60-
bool disable_sharing : 1; ///< Whether or not Sharing of the Mii is allowed
61-
u8 shape : 4; ///< Face shape
62-
u8 skinColor : 3; ///< Color of skin
63-
} face_style;
67+
u16 disable_sharing : 1; ///< Whether or not Sharing of the Mii is allowed
68+
u16 shape : 4; ///< Face shape
69+
u16 skinColor : 3; ///< Color of skin
70+
} CTR_PACKED face_style;
6471

6572
/// Face details
6673
struct
6774
{
68-
u8 wrinkles : 4;
69-
u8 makeup : 4;
70-
} face_details;
75+
u16 wrinkles : 4;
76+
u16 makeup : 4;
77+
} CTR_PACKED face_details;
7178

7279
u8 hair_style;
7380

7481
/// Hair details
7582
struct
7683
{
77-
u8 color : 3;
78-
bool flip : 1;
79-
} hair_details;
84+
u16 color : 3;
85+
u16 flip : 1;
86+
u16 _pad : 4;
87+
} CTR_PACKED hair_details;
8088

8189
/// Eye details
8290
struct
8391
{
84-
u32 style : 6;
85-
u32 color : 3;
86-
u32 scale : 4;
87-
u32 yscale : 3;
88-
u32 rotation : 5;
89-
u32 xspacing : 4;
90-
u32 yposition : 5;
91-
} eye_details;
92+
u16 style : 6;
93+
u16 color : 3;
94+
u16 scale : 4;
95+
u16 yscale : 3;
96+
u16 rotation : 5;
97+
u16 xspacing : 4;
98+
u16 yposition : 5;
99+
u16 _pad : 2;
100+
} CTR_PACKED eye_details;
92101

93102
/// Eyebrow details
94103
struct
95104
{
96-
u32 style : 5;
97-
u32 color : 3;
98-
u32 scale : 4;
99-
u32 yscale : 3;
100-
u32 pad : 1;
101-
u32 rotation : 5;
102-
u32 xspacing : 4;
103-
u32 yposition : 5;
104-
} eyebrow_details;
105+
u16 style : 5;
106+
u16 color : 3;
107+
u16 scale : 4;
108+
u16 yscale : 3;
109+
u16 _pad : 1;
110+
u16 rotation : 4;
111+
u16 xspacing : 4;
112+
u16 yposition : 5;
113+
u16 _pad2 : 3;
114+
} CTR_PACKED eyebrow_details;
105115

106116
/// Nose details
107117
struct
108118
{
109119
u16 style : 5;
110120
u16 scale : 4;
111121
u16 yposition : 5;
112-
} nose_details;
122+
u16 _pad : 2;
123+
} CTR_PACKED nose_details;
113124

114125
/// Mouth details
115126
struct
@@ -118,15 +129,15 @@ typedef struct
118129
u16 color : 3;
119130
u16 scale : 4;
120131
u16 yscale : 3;
121-
} mouth_details;
132+
} CTR_PACKED mouth_details;
122133

123134
/// Mustache details
124135
struct
125136
{
126137
u16 mouth_yposition : 5;
127-
u16 mustach_style : 3;
128-
u16 pad : 2;
129-
} mustache_details;
138+
u16 mustache_style : 3;
139+
u16 _pad : 8;
140+
} CTR_PACKED mustache_details;
130141

131142
/// Beard details
132143
struct
@@ -135,7 +146,8 @@ typedef struct
135146
u16 color : 3;
136147
u16 scale : 4;
137148
u16 ypos : 5;
138-
} beard_details;
149+
u16 _pad : 1;
150+
} CTR_PACKED beard_details;
139151

140152
/// Glasses details
141153
struct
@@ -144,16 +156,17 @@ typedef struct
144156
u16 color : 3;
145157
u16 scale : 4;
146158
u16 ypos : 5;
147-
} glasses_details;
159+
} CTR_PACKED glasses_details;
148160

149161
/// Mole details
150162
struct
151163
{
152164
bool enable : 1;
153-
u16 scale : 5;
165+
u16 scale : 4;
154166
u16 xpos : 5;
155167
u16 ypos : 5;
156-
} mole_details;
168+
u16 _pad : 1;
169+
} CTR_PACKED mole_details;
157170

158171
u16 author_name[10]; ///< Name of Mii's author (Encoded using UTF16)
159172
} CTR_PACKED MiiData;

0 commit comments

Comments
 (0)