-
Notifications
You must be signed in to change notification settings - Fork 8
/
gen2_wiiu_3ds_miitomo.py
390 lines (301 loc) · 15.2 KB
/
gen2_wiiu_3ds_miitomo.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# This is a generated file! Please edit source .ksy file and use kaitai-struct-compiler to rebuild
from pkg_resources import parse_version
import kaitaistruct
from kaitaistruct import KaitaiStruct, KaitaiStream, BytesIO
if parse_version(kaitaistruct.__version__) < parse_version('0.9'):
raise Exception("Incompatible Kaitai Struct Python API: 0.9 or later is required, but you have %s" % (
kaitaistruct.__version__))
class Gen2Wiiu3dsMiitomo(KaitaiStruct):
def __init__(self, _io, _parent=None, _root=None):
self._io = _io
self._parent = _parent
self._root = _root if _root else self
self._read()
def _read(self):
self.unknown_1 = self._io.read_u1()
self.character_set = self._io.read_bits_int_be(2)
self.region_lock = self._io.read_bits_int_be(2)
self.profanity_flag = self._io.read_bits_int_be(1) != 0
self.copying = self._io.read_bits_int_be(1) != 0
self.unknown_2 = self._io.read_bits_int_be(2)
self.mii_position_slot_index = self._io.read_bits_int_be(4)
self.mii_position_page_index = self._io.read_bits_int_be(4)
self.version = self._io.read_bits_int_be(4)
self.unknown_3 = self._io.read_bits_int_be(4)
self._io.align_to_byte()
self.system_id = [None] * (8)
for i in range(8):
self.system_id[i] = self._io.read_u1()
self.avatar_id = [None] * (4)
for i in range(4):
self.avatar_id[i] = self._io.read_u1()
self.client_id = [None] * (6)
for i in range(6):
self.client_id[i] = self._io.read_u1()
self.padding = self._io.read_u2le()
self.data_1 = self._io.read_u2le()
self.mii_name = (self._io.read_bytes(20)).decode(u"utf-16le")
self.body_height = self._io.read_u1()
self.body_weight = self._io.read_u1()
self.face_color = self._io.read_bits_int_be(3)
self.face_type = self._io.read_bits_int_be(4)
self.mingle = self._io.read_bits_int_be(1) != 0
self.face_makeup = self._io.read_bits_int_be(4)
self.face_wrinkles = self._io.read_bits_int_be(4)
self._io.align_to_byte()
self.hair_type = self._io.read_u1()
self.unknown_5 = self._io.read_bits_int_be(4)
self.hair_flip = self._io.read_bits_int_be(1) != 0
self.hair_color = self._io.read_bits_int_be(3)
self._io.align_to_byte()
self.eye = self._io.read_u4le()
self.eyebrow = self._io.read_u4le()
self.nose = self._io.read_u2le()
self.mouth = self._io.read_u2le()
self.mouth2 = self._io.read_u2le()
self.beard = self._io.read_u2le()
self.glasses = self._io.read_u2le()
self.mole = self._io.read_u2le()
self.creator_name = (self._io.read_bytes(20)).decode(u"utf-16le")
self.padding2 = self._io.read_u2le()
self.checksum = self._io.read_u2le()
@property
def glasses_color(self):
if hasattr(self, '_m_glasses_color'):
return self._m_glasses_color if hasattr(self, '_m_glasses_color') else None
self._m_glasses_color = ((self.glasses >> 4) & 7)
return self._m_glasses_color if hasattr(self, '_m_glasses_color') else None
@property
def eyebrow_horizontal(self):
if hasattr(self, '_m_eyebrow_horizontal'):
return self._m_eyebrow_horizontal if hasattr(self, '_m_eyebrow_horizontal') else None
self._m_eyebrow_horizontal = ((self.eyebrow >> 21) & 15)
return self._m_eyebrow_horizontal if hasattr(self, '_m_eyebrow_horizontal') else None
@property
def eye_vertical(self):
if hasattr(self, '_m_eye_vertical'):
return self._m_eye_vertical if hasattr(self, '_m_eye_vertical') else None
self._m_eye_vertical = ((self.eye >> 25) & 31)
return self._m_eye_vertical if hasattr(self, '_m_eye_vertical') else None
@property
def facial_hair_beard(self):
if hasattr(self, '_m_facial_hair_beard'):
return self._m_facial_hair_beard if hasattr(self, '_m_facial_hair_beard') else None
self._m_facial_hair_beard = (self.beard & 7)
return self._m_facial_hair_beard if hasattr(self, '_m_facial_hair_beard') else None
@property
def mouth_size(self):
if hasattr(self, '_m_mouth_size'):
return self._m_mouth_size if hasattr(self, '_m_mouth_size') else None
self._m_mouth_size = ((self.mouth >> 9) & 15)
return self._m_mouth_size if hasattr(self, '_m_mouth_size') else None
@property
def eyebrow_stretch(self):
if hasattr(self, '_m_eyebrow_stretch'):
return self._m_eyebrow_stretch if hasattr(self, '_m_eyebrow_stretch') else None
self._m_eyebrow_stretch = ((self.eyebrow >> 12) & 7)
return self._m_eyebrow_stretch if hasattr(self, '_m_eyebrow_stretch') else None
@property
def nose_vertical(self):
if hasattr(self, '_m_nose_vertical'):
return self._m_nose_vertical if hasattr(self, '_m_nose_vertical') else None
self._m_nose_vertical = ((self.nose >> 9) & 31)
return self._m_nose_vertical if hasattr(self, '_m_nose_vertical') else None
@property
def eye_color(self):
if hasattr(self, '_m_eye_color'):
return self._m_eye_color if hasattr(self, '_m_eye_color') else None
self._m_eye_color = ((self.eye >> 6) & 7)
return self._m_eye_color if hasattr(self, '_m_eye_color') else None
@property
def birth_month(self):
if hasattr(self, '_m_birth_month'):
return self._m_birth_month if hasattr(self, '_m_birth_month') else None
self._m_birth_month = ((self.data_1 >> 1) & 15)
return self._m_birth_month if hasattr(self, '_m_birth_month') else None
@property
def mouth_color(self):
if hasattr(self, '_m_mouth_color'):
return self._m_mouth_color if hasattr(self, '_m_mouth_color') else None
self._m_mouth_color = ((self.mouth >> 6) & 7)
return self._m_mouth_color if hasattr(self, '_m_mouth_color') else None
@property
def mole_horizontal(self):
if hasattr(self, '_m_mole_horizontal'):
return self._m_mole_horizontal if hasattr(self, '_m_mole_horizontal') else None
self._m_mole_horizontal = ((self.mole >> 5) & 31)
return self._m_mole_horizontal if hasattr(self, '_m_mole_horizontal') else None
@property
def facial_hair_mustache(self):
if hasattr(self, '_m_facial_hair_mustache'):
return self._m_facial_hair_mustache if hasattr(self, '_m_facial_hair_mustache') else None
self._m_facial_hair_mustache = ((self.mouth2 >> 5) & 7)
return self._m_facial_hair_mustache if hasattr(self, '_m_facial_hair_mustache') else None
@property
def eyebrow_rotation(self):
if hasattr(self, '_m_eyebrow_rotation'):
return self._m_eyebrow_rotation if hasattr(self, '_m_eyebrow_rotation') else None
self._m_eyebrow_rotation = ((self.eyebrow >> 16) & 15)
return self._m_eyebrow_rotation if hasattr(self, '_m_eyebrow_rotation') else None
@property
def mole_vertical(self):
if hasattr(self, '_m_mole_vertical'):
return self._m_mole_vertical if hasattr(self, '_m_mole_vertical') else None
self._m_mole_vertical = ((self.mole >> 10) & 31)
return self._m_mole_vertical if hasattr(self, '_m_mole_vertical') else None
@property
def glasses_type(self):
if hasattr(self, '_m_glasses_type'):
return self._m_glasses_type if hasattr(self, '_m_glasses_type') else None
self._m_glasses_type = (self.glasses & 15)
return self._m_glasses_type if hasattr(self, '_m_glasses_type') else None
@property
def eyebrow_size(self):
if hasattr(self, '_m_eyebrow_size'):
return self._m_eyebrow_size if hasattr(self, '_m_eyebrow_size') else None
self._m_eyebrow_size = ((self.eyebrow >> 8) & 15)
return self._m_eyebrow_size if hasattr(self, '_m_eyebrow_size') else None
@property
def mole_size(self):
if hasattr(self, '_m_mole_size'):
return self._m_mole_size if hasattr(self, '_m_mole_size') else None
self._m_mole_size = ((self.mole >> 1) & 15)
return self._m_mole_size if hasattr(self, '_m_mole_size') else None
@property
def nose_size(self):
if hasattr(self, '_m_nose_size'):
return self._m_nose_size if hasattr(self, '_m_nose_size') else None
self._m_nose_size = ((self.nose >> 5) & 15)
return self._m_nose_size if hasattr(self, '_m_nose_size') else None
@property
def facial_hair_vertical(self):
if hasattr(self, '_m_facial_hair_vertical'):
return self._m_facial_hair_vertical if hasattr(self, '_m_facial_hair_vertical') else None
self._m_facial_hair_vertical = ((self.beard >> 10) & 31)
return self._m_facial_hair_vertical if hasattr(self, '_m_facial_hair_vertical') else None
@property
def eye_stretch(self):
if hasattr(self, '_m_eye_stretch'):
return self._m_eye_stretch if hasattr(self, '_m_eye_stretch') else None
self._m_eye_stretch = ((self.eye >> 13) & 7)
return self._m_eye_stretch if hasattr(self, '_m_eye_stretch') else None
@property
def eye_size(self):
if hasattr(self, '_m_eye_size'):
return self._m_eye_size if hasattr(self, '_m_eye_size') else None
self._m_eye_size = ((self.eye >> 9) & 7)
return self._m_eye_size if hasattr(self, '_m_eye_size') else None
@property
def eye_type(self):
if hasattr(self, '_m_eye_type'):
return self._m_eye_type if hasattr(self, '_m_eye_type') else None
self._m_eye_type = (self.eye & 63)
return self._m_eye_type if hasattr(self, '_m_eye_type') else None
@property
def eye_horizontal(self):
if hasattr(self, '_m_eye_horizontal'):
return self._m_eye_horizontal if hasattr(self, '_m_eye_horizontal') else None
self._m_eye_horizontal = ((self.eye >> 21) & 15)
return self._m_eye_horizontal if hasattr(self, '_m_eye_horizontal') else None
@property
def eyebrow_type(self):
if hasattr(self, '_m_eyebrow_type'):
return self._m_eyebrow_type if hasattr(self, '_m_eyebrow_type') else None
self._m_eyebrow_type = (self.eyebrow & 31)
return self._m_eyebrow_type if hasattr(self, '_m_eyebrow_type') else None
@property
def mouth_vertical(self):
if hasattr(self, '_m_mouth_vertical'):
return self._m_mouth_vertical if hasattr(self, '_m_mouth_vertical') else None
self._m_mouth_vertical = (self.mouth2 & 31)
return self._m_mouth_vertical if hasattr(self, '_m_mouth_vertical') else None
@property
def eyebrow_color(self):
if hasattr(self, '_m_eyebrow_color'):
return self._m_eyebrow_color if hasattr(self, '_m_eyebrow_color') else None
self._m_eyebrow_color = ((self.eyebrow >> 5) & 7)
return self._m_eyebrow_color if hasattr(self, '_m_eyebrow_color') else None
@property
def nose_type(self):
if hasattr(self, '_m_nose_type'):
return self._m_nose_type if hasattr(self, '_m_nose_type') else None
self._m_nose_type = (self.nose & 31)
return self._m_nose_type if hasattr(self, '_m_nose_type') else None
@property
def facial_hair_color(self):
if hasattr(self, '_m_facial_hair_color'):
return self._m_facial_hair_color if hasattr(self, '_m_facial_hair_color') else None
self._m_facial_hair_color = ((self.beard >> 3) & 7)
return self._m_facial_hair_color if hasattr(self, '_m_facial_hair_color') else None
@property
def eyebrow_vertical(self):
if hasattr(self, '_m_eyebrow_vertical'):
return self._m_eyebrow_vertical if hasattr(self, '_m_eyebrow_vertical') else None
self._m_eyebrow_vertical = ((self.eyebrow >> 25) & 31)
return self._m_eyebrow_vertical if hasattr(self, '_m_eyebrow_vertical') else None
@property
def glasses_size(self):
if hasattr(self, '_m_glasses_size'):
return self._m_glasses_size if hasattr(self, '_m_glasses_size') else None
self._m_glasses_size = ((self.glasses >> 7) & 15)
return self._m_glasses_size if hasattr(self, '_m_glasses_size') else None
@property
def eye_rotation(self):
if hasattr(self, '_m_eye_rotation'):
return self._m_eye_rotation if hasattr(self, '_m_eye_rotation') else None
self._m_eye_rotation = ((self.eye >> 16) & 31)
return self._m_eye_rotation if hasattr(self, '_m_eye_rotation') else None
@property
def gender(self):
if hasattr(self, '_m_gender'):
return self._m_gender if hasattr(self, '_m_gender') else None
self._m_gender = (self.data_1 & 1)
return self._m_gender if hasattr(self, '_m_gender') else None
@property
def birth_day(self):
if hasattr(self, '_m_birth_day'):
return self._m_birth_day if hasattr(self, '_m_birth_day') else None
self._m_birth_day = ((self.data_1 >> 5) & 31)
return self._m_birth_day if hasattr(self, '_m_birth_day') else None
@property
def mouth_stretch(self):
if hasattr(self, '_m_mouth_stretch'):
return self._m_mouth_stretch if hasattr(self, '_m_mouth_stretch') else None
self._m_mouth_stretch = ((self.mouth >> 13) & 7)
return self._m_mouth_stretch if hasattr(self, '_m_mouth_stretch') else None
@property
def mole_enable(self):
if hasattr(self, '_m_mole_enable'):
return self._m_mole_enable if hasattr(self, '_m_mole_enable') else None
self._m_mole_enable = (self.mole >> 15)
return self._m_mole_enable if hasattr(self, '_m_mole_enable') else None
@property
def favorite(self):
if hasattr(self, '_m_favorite'):
return self._m_favorite if hasattr(self, '_m_favorite') else None
self._m_favorite = ((self.data_1 >> 14) & 1)
return self._m_favorite if hasattr(self, '_m_favorite') else None
@property
def glasses_vertical(self):
if hasattr(self, '_m_glasses_vertical'):
return self._m_glasses_vertical if hasattr(self, '_m_glasses_vertical') else None
self._m_glasses_vertical = ((self.glasses >> 11) & 15)
return self._m_glasses_vertical if hasattr(self, '_m_glasses_vertical') else None
@property
def favorite_color(self):
if hasattr(self, '_m_favorite_color'):
return self._m_favorite_color if hasattr(self, '_m_favorite_color') else None
self._m_favorite_color = ((self.data_1 >> 10) & 15)
return self._m_favorite_color if hasattr(self, '_m_favorite_color') else None
@property
def mouth_type(self):
if hasattr(self, '_m_mouth_type'):
return self._m_mouth_type if hasattr(self, '_m_mouth_type') else None
self._m_mouth_type = (self.mouth & 63)
return self._m_mouth_type if hasattr(self, '_m_mouth_type') else None
@property
def facial_hair_size(self):
if hasattr(self, '_m_facial_hair_size'):
return self._m_facial_hair_size if hasattr(self, '_m_facial_hair_size') else None
self._m_facial_hair_size = ((self.beard >> 6) & 15)
return self._m_facial_hair_size if hasattr(self, '_m_facial_hair_size') else None