miijs 2.3.4 → 2.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -25,1125 +25,7 @@ const FFLShaderMaterial = require("ffl.js/FFLShaderMaterial.js");
25
25
  /** @typedef {import('./types').WiiMii} WiiMii */
26
26
 
27
27
  //Miscellaneous Tables
28
- const lookupTables = {
29
- //Universals
30
- favCols: ["Red", "Orange", "Yellow", "Lime", "Green", "Blue", "Cyan", "Pink", "Purple", "Brown", "White", "Black"],
31
- skinCols: ["White", "Tanned White", "Darker White", "Tanned Darker", "Mostly Black", "Black"],
32
- hairCols: ["Black", "Brown", "Red", "Reddish Brown", "Grey", "Light Brown", "Dark Blonde", "Blonde"],
33
- eyeCols: ["Black", "Grey", "Brown", "Lime", "Blue", "Green"],
34
-
35
- //Wii fields
36
- wiiFaceFeatures: ["None", "Blush", "Makeup and Blush", "Freckles", "Bags", "Wrinkles on Cheeks", "Wrinkles near Eyes", "Chin Wrinkle", "Makeup", "Stubble", "Wrinkles near Mouth", "Wrinkles"],
37
- wiiMouthColors: ["Peach", "Red", "Pink"],
38
- wiiGlassesCols: ["Grey", "Brown", "Red", "Blue", "Yellow", "White"],
39
- wiiNoses: {
40
- "1": 0,
41
- "10": 1,
42
- "2": 2,
43
- "3": 3,
44
- "6": 4,
45
- "0": 5,
46
- "5": 6,
47
- "4": 7,
48
- "8": 8,
49
- "9": 9,
50
- "7": 10,
51
- },
52
- pages: {
53
- mouths: {
54
- '0': 1,
55
- '1': 1,
56
- '2': 2,
57
- '3': 2,
58
- '4': 2,
59
- '5': 1,
60
- '6': 1,
61
- '7': 2,
62
- '8': 1,
63
- '9': 2,
64
- '10': 1,
65
- '11': 2,
66
- '12': 2,
67
- '13': 1,
68
- '14': 2,
69
- '15': 2,
70
- '16': 1,
71
- '17': 2,
72
- '18': 2,
73
- '19': 1,
74
- '20': 2,
75
- '21': 1,
76
- '22': 1,
77
- '23': 1
78
- },
79
- eyebrows: {
80
- '0': 1,
81
- '1': 1,
82
- '2': 2,
83
- '3': 2,
84
- '4': 1,
85
- '5': 1,
86
- '6': 1,
87
- '7': 1,
88
- '8': 1,
89
- '9': 1,
90
- '10': 2,
91
- '11': 2,
92
- '12': 1,
93
- '13': 2,
94
- '14': 2,
95
- '15': 2,
96
- '16': 2,
97
- '17': 1,
98
- '18': 2,
99
- '19': 1,
100
- '20': 2,
101
- '21': 1,
102
- '22': 2,
103
- '23': 2
104
- },
105
- eyes: {
106
- 0: 1,
107
- 1: 1,
108
- 2: 1,
109
- 3: 4,
110
- 4: 1,
111
- 5: 3,
112
- 6: 3,
113
- 7: 4,
114
- 8: 1,
115
- 9: 2,
116
- 10: 4,
117
- 11: 2,
118
- 12: 2,
119
- 13: 3,
120
- 14: 4,
121
- 15: 1,
122
- 16: 1,
123
- 17: 1,
124
- 18: 3,
125
- 19: 2,
126
- 20: 1,
127
- 21: 2,
128
- 22: 4,
129
- 23: 2,
130
- 24: 3,
131
- 25: 2,
132
- 26: 1,
133
- 27: 1,
134
- 28: 3,
135
- 29: 4,
136
- 30: 3,
137
- 31: 3,
138
- 32: 2,
139
- 33: 2,
140
- 34: 2,
141
- 35: 2,
142
- 36: 3,
143
- 37: 3,
144
- 38: 4,
145
- 39: 1,
146
- 40: 2,
147
- 41: 3,
148
- 42: 4,
149
- 43: 4,
150
- 44: 4,
151
- 45: 4,
152
- 46: 3,
153
- 47: 4
154
- },
155
- hairs: {
156
- '0': 5,
157
- '1': 4,
158
- '2': 6,
159
- '3': 5,
160
- '4': 4,
161
- '5': 4,
162
- '6': 5,
163
- '7': 4,
164
- '8': 4,
165
- '9': 6,
166
- '10': 5,
167
- '11': 5,
168
- '12': 4,
169
- '13': 4,
170
- '14': 5,
171
- '15': 6,
172
- '16': 6,
173
- '17': 5,
174
- '18': 6,
175
- '19': 4,
176
- '20': 5,
177
- '21': 5,
178
- '22': 5,
179
- '23': 3,
180
- '24': 6,
181
- '25': 4,
182
- '26': 4,
183
- '27': 4,
184
- '28': 6,
185
- '29': 6,
186
- '30': 3,
187
- '31': 1,
188
- '32': 2,
189
- '33': 1,
190
- '34': 3,
191
- '35': 5,
192
- '36': 3,
193
- '37': 2,
194
- '38': 3,
195
- '39': 1,
196
- '40': 1,
197
- '41': 3,
198
- '42': 3,
199
- '43': 3,
200
- '44': 1,
201
- '45': 1,
202
- '46': 6,
203
- '47': 2,
204
- '48': 2,
205
- '49': 1,
206
- '50': 2,
207
- '51': 1,
208
- '52': 2,
209
- '53': 6,
210
- '54': 3,
211
- '55': 2,
212
- '56': 1,
213
- '57': 3,
214
- '58': 2,
215
- '59': 1,
216
- '60': 2,
217
- '61': 6,
218
- '62': 2,
219
- '63': 5,
220
- '64': 2,
221
- '65': 3,
222
- '66': 2,
223
- '67': 3,
224
- '68': 1,
225
- '69': 4,
226
- '70': 1,
227
- '71': 6
228
- }
229
- },
230
- types: {
231
- "mouths": {
232
- "0": 6,
233
- "1": 1,
234
- "2": 2,
235
- "3": 4,
236
- "4": 5,
237
- "5": 5,
238
- "6": 10,
239
- "7": 0,
240
- "8": 7,
241
- "9": 1,
242
- "10": 8,
243
- "11": 7,
244
- "12": 11,
245
- "13": 11,
246
- "14": 10,
247
- "15": 6,
248
- "16": 9,
249
- "17": 3,
250
- "18": 9,
251
- "19": 2,
252
- "20": 8,
253
- "21": 3,
254
- "22": 4,
255
- "23": 0
256
- },
257
- "eyebrows": {
258
- "0": 1,
259
- "1": 3,
260
- "2": 2,
261
- "3": 3,
262
- "4": 11,
263
- "5": 10,
264
- "6": 0,
265
- "7": 6,
266
- "8": 8,
267
- "9": 4,
268
- "10": 1,
269
- "11": 0,
270
- "12": 2,
271
- "13": 7,
272
- "14": 4,
273
- "15": 6,
274
- "16": 10,
275
- "17": 9,
276
- "18": 9,
277
- "19": 5,
278
- "20": 5,
279
- "21": 7,
280
- "22": 8,
281
- "23": 11
282
- },
283
- "eyes": {
284
- "0": 2,
285
- "1": 6,
286
- "2": 0,
287
- "3": 6,
288
- "4": 1,
289
- "5": 0,
290
- "6": 5,
291
- "7": 0,
292
- "8": 3,
293
- "9": 4,
294
- "10": 9,
295
- "11": 1,
296
- "12": 5,
297
- "13": 2,
298
- "14": 10,
299
- "15": 9,
300
- "16": 8,
301
- "17": 5,
302
- "18": 9,
303
- "19": 2,
304
- "20": 11,
305
- "21": 8,
306
- "22": 8,
307
- "23": 6,
308
- "24": 6,
309
- "25": 9,
310
- "26": 7,
311
- "27": 10,
312
- "28": 10,
313
- "29": 5,
314
- "30": 7,
315
- "31": 8,
316
- "32": 3,
317
- "33": 0,
318
- "34": 7,
319
- "35": 11,
320
- "36": 3,
321
- "37": 4,
322
- "38": 2,
323
- "39": 4,
324
- "40": 10,
325
- "41": 1,
326
- "42": 3,
327
- "43": 7,
328
- "44": 1,
329
- "45": 4,
330
- "46": 11,
331
- "47": 11
332
- },
333
- "hairs": {
334
- "0": 11,
335
- "1": 6,
336
- "2": 5,
337
- "3": 1,
338
- "4": 4,
339
- "5": 8,
340
- "6": 4,
341
- "7": 11,
342
- "8": 9,
343
- "9": 3,
344
- "10": 3,
345
- "11": 6,
346
- "12": 0,
347
- "13": 1,
348
- "14": 0,
349
- "15": 10,
350
- "16": 1,
351
- "17": 8,
352
- "18": 4,
353
- "19": 7,
354
- "20": 5,
355
- "21": 10,
356
- "22": 2,
357
- "23": 3,
358
- "24": 9,
359
- "25": 5,
360
- "26": 3,
361
- "27": 10,
362
- "28": 6,
363
- "29": 11,
364
- "30": 9,
365
- "31": 11,
366
- "32": 0,
367
- "33": 0,
368
- "34": 11,
369
- "35": 9,
370
- "36": 6,
371
- "37": 2,
372
- "38": 1,
373
- "39": 4,
374
- "40": 1,
375
- "41": 7,
376
- "42": 2,
377
- "43": 0,
378
- "44": 3,
379
- "45": 6,
380
- "46": 2,
381
- "47": 1,
382
- "48": 3,
383
- "49": 7,
384
- "50": 7,
385
- "51": 2,
386
- "52": 5,
387
- "53": 7,
388
- "54": 5,
389
- "55": 8,
390
- "56": 9,
391
- "57": 10,
392
- "58": 6,
393
- "59": 8,
394
- "60": 10,
395
- "61": 0,
396
- "62": 11,
397
- "63": 7,
398
- "64": 9,
399
- "65": 8,
400
- "66": 4,
401
- "67": 4,
402
- "68": 10,
403
- "69": 2,
404
- "70": 5,
405
- "71": 8
406
- }
407
- },
408
- wiiNoses: {
409
- '0': 1,
410
- '1': 10,
411
- '2': 2,
412
- '3': 3,
413
- '4': 6,
414
- '5': 0,
415
- '6': 5,
416
- '7': 4,
417
- '8': 8,
418
- '9': 9,
419
- '10': 7,
420
- '11': 11
421
- },
422
- mouthTable: {
423
- '0': '113',
424
- '1': '121',
425
- '2': '231',
426
- '3': '222',
427
- '4': '232',
428
- '5': '132',
429
- '6': '124',
430
- '7': '211',
431
- '8': '123',
432
- '9': '221',
433
- '10': '133',
434
- '11': '223',
435
- '12': '234',
436
- '13': '134',
437
- '14': '224',
438
- '15': '213',
439
- '16': '114',
440
- '17': '212',
441
- '18': '214',
442
- '19': '131',
443
- '20': '233',
444
- '21': '112',
445
- '22': '122',
446
- '23': '111'
447
- },
448
- eyebrowTable: {
449
- '0': '121',
450
- '1': '112',
451
- '2': '231',
452
- '3': '212',
453
- '4': '134',
454
- '5': '124',
455
- '6': '111',
456
- '7': '113',
457
- '8': '133',
458
- '9': '122',
459
- '10': '221',
460
- '11': '211',
461
- '12': '131',
462
- '13': '223',
463
- '14': '222',
464
- '15': '213',
465
- '16': '224',
466
- '17': '114',
467
- '18': '214',
468
- '19': '132',
469
- '20': '232',
470
- '21': '123',
471
- '22': '233',
472
- '23': '234'
473
- },
474
- eyeTable: {
475
- '0': '131',
476
- '1': '113',
477
- '2': '111',
478
- '3': '413',
479
- '4': '121',
480
- '5': '311',
481
- '6': '332',
482
- '7': '411',
483
- '8': '112',
484
- '9': '222',
485
- '10': '414',
486
- '11': '221',
487
- '12': '232',
488
- '13': '331',
489
- '14': '424',
490
- '15': '114',
491
- '16': '133',
492
- '17': '132',
493
- '18': '314',
494
- '19': '231',
495
- '20': '134',
496
- '21': '233',
497
- '22': '433',
498
- '23': '213',
499
- '24': '313',
500
- '25': '214',
501
- '26': '123',
502
- '27': '124',
503
- '28': '324',
504
- '29': '432',
505
- '30': '323',
506
- '31': '333',
507
- '32': '212',
508
- '33': '211',
509
- '34': '223',
510
- '35': '234',
511
- '36': '312',
512
- '37': '322',
513
- '38': '431',
514
- '39': '122',
515
- '40': '224',
516
- '41': '321',
517
- '42': '412',
518
- '43': '423',
519
- '44': '421',
520
- '45': '422',
521
- '46': '334',
522
- '47': '434'
523
- },
524
- hairTable: {
525
- '0': '534',
526
- '1': '413',
527
- '2': '632',
528
- '3': '521',
529
- '4': '422',
530
- '5': '433',
531
- '6': '522',
532
- '7': '434',
533
- '8': '414',
534
- '9': '612',
535
- '10': '512',
536
- '11': '513',
537
- '12': '411',
538
- '13': '421',
539
- '14': '511',
540
- '15': '624',
541
- '16': '621',
542
- '17': '533',
543
- '18': '622',
544
- '19': '423',
545
- '20': '532',
546
- '21': '524',
547
- '22': '531',
548
- '23': '312',
549
- '24': '614',
550
- '25': '432',
551
- '26': '412',
552
- '27': '424',
553
- '28': '613',
554
- '29': '634',
555
- '30': '314',
556
- '31': '134',
557
- '32': '211',
558
- '33': '111',
559
- '34': '334',
560
- '35': '514',
561
- '36': '313',
562
- '37': '231',
563
- '38': '321',
564
- '39': '122',
565
- '40': '121',
566
- '41': '323',
567
- '42': '331',
568
- '43': '311',
569
- '44': '112',
570
- '45': '113',
571
- '46': '631',
572
- '47': '221',
573
- '48': '212',
574
- '49': '123',
575
- '50': '223',
576
- '51': '131',
577
- '52': '232',
578
- '53': '623',
579
- '54': '332',
580
- '55': '233',
581
- '56': '114',
582
- '57': '324',
583
- '58': '213',
584
- '59': '133',
585
- '60': '224',
586
- '61': '611',
587
- '62': '234',
588
- '63': '523',
589
- '64': '214',
590
- '65': '333',
591
- '66': '222',
592
- '67': '322',
593
- '68': '124',
594
- '69': '431',
595
- '70': '132',
596
- '71': '633'
597
- },
598
-
599
- // 3DS fields
600
- faceFeatures3DS: ["None", "Near Eye Creases", "Cheek Creases", "Far Eye Creases", "Near Nose Creases", "Giant Bags", "Cleft Chin", "Chin Crease", "Sunken Eyes", "Far Cheek Creases", "Lines Near Eyes", "Wrinkles"],
601
- makeups3DS: ["None", "Blush", "Orange Blush", "Blue Eyes", "Blush 2", "Orange Blush 2", "Blue Eyes and Blush", "Orange Eyes and Blush", "Purple Eyes and Blush 2", "Freckles", "Beard Stubble", "Beard and Mustache Stubble"],
602
- mouthCols3DS: ["Orange", "Red", "Pink", "Peach", "Black"],
603
- glassesCols3DS: ["Black", "Brown", "Red", "Blue", "Yellow", "Grey"],
604
-
605
- faces: {
606
- indexLookup: true,
607
- values: [
608
- 0x00, 0x01, 0x08,
609
- 0x02, 0x03, 0x09,
610
- 0x04, 0x05, 0x0a,
611
- 0x06, 0x07, 0x0b
612
- ]
613
- },
614
- hairs: {
615
- paginated: true,
616
- indexLookup: true,
617
- values: [
618
- [0x21, 0x2f, 0x28, 0x25, 0x20, 0x6b, 0x30, 0x33, 0x37, 0x46, 0x2c, 0x42],
619
- [0x34, 0x32, 0x26, 0x31, 0x2b, 0x1f, 0x38, 0x44, 0x3e, 0x73, 0x4c, 0x77],
620
- [0x40, 0x51, 0x74, 0x79, 0x16, 0x3a, 0x3c, 0x57, 0x7d, 0x75, 0x49, 0x4b],
621
- [0x2a, 0x59, 0x39, 0x36, 0x50, 0x22, 0x17, 0x56, 0x58, 0x76, 0x27, 0x24],
622
- [0x2d, 0x43, 0x3b, 0x41, 0x29, 0x1e, 0x0c, 0x10, 0x0a, 0x52, 0x80, 0x81],
623
- [0x0e, 0x5f, 0x69, 0x64, 0x06, 0x14, 0x5d, 0x66, 0x1b, 0x04, 0x11, 0x6e],
624
- [0x7b, 0x08, 0x6a, 0x48, 0x03, 0x15, 0x00, 0x62, 0x3f, 0x5a, 0x0b, 0x78],
625
- [0x05, 0x4a, 0x6c, 0x5e, 0x7c, 0x19, 0x63, 0x45, 0x23, 0x0d, 0x7a, 0x71],
626
- [0x35, 0x18, 0x55, 0x53, 0x47, 0x83, 0x60, 0x65, 0x1d, 0x07, 0x0f, 0x70],
627
- [0x4f, 0x01, 0x6d, 0x7f, 0x5b, 0x1a, 0x3d, 0x67, 0x02, 0x4d, 0x12, 0x5c],
628
- [0x54, 0x09, 0x13, 0x82, 0x61, 0x68, 0x2e, 0x4e, 0x1c, 0x72, 0x7e, 0x6f]
629
- ]
630
- },
631
- eyebrows: {
632
- indexLookup: true,
633
- paginated: true,
634
- values: [
635
- [0x06, 0x00, 0x0c, 0x01, 0x09, 0x13, 0x07, 0x15, 0x08, 0x11, 0x05, 0x04],
636
- [0x0b, 0x0a, 0x02, 0x03, 0x0e, 0x14, 0x0f, 0x0d, 0x16, 0x12, 0x10, 0x17]
637
- ]
638
- },
639
- eyes: {
640
- indexLookup: true,
641
- paginated: true,
642
- values: [
643
- [0x02, 0x04, 0x00, 0x08, 0x27, 0x11, 0x01, 0x1a, 0x10, 0x0f, 0x1b, 0x14],
644
- [0x21, 0x0b, 0x13, 0x20, 0x09, 0x0c, 0x17, 0x22, 0x15, 0x19, 0x28, 0x23],
645
- [0x05, 0x29, 0x0d, 0x24, 0x25, 0x06, 0x18, 0x1e, 0x1f, 0x12, 0x1c, 0x2e],
646
- [0x07, 0x2c, 0x26, 0x2a, 0x2d, 0x1d, 0x03, 0x2b, 0x16, 0x0a, 0x0e, 0x2f],
647
- [0x30, 0x31, 0x32, 0x35, 0x3b, 0x38, 0x36, 0x3a, 0x39, 0x37, 0x33, 0x34]
648
- ]
649
- },
650
- noses: {
651
- indexLookup: true,
652
- paginated: true,
653
- values: [
654
- [0x01, 0x0a, 0x02, 0x03, 0x06, 0x00, 0x05, 0x04, 0x08, 0x09, 0x07, 0x0B],
655
- [0x0d, 0x0e, 0x0c, 0x11, 0x10, 0x0f]
656
- ]
657
- },
658
- mouths: {
659
- indexLookup: true,
660
- paginated: true,
661
- values: [
662
- [0x17, 0x01, 0x13, 0x15, 0x16, 0x05, 0x00, 0x08, 0x0a, 0x10, 0x06, 0x0d],
663
- [0x07, 0x09, 0x02, 0x11, 0x03, 0x04, 0x0f, 0x0b, 0x14, 0x12, 0x0e, 0x0c],
664
- [0x1b, 0x1e, 0x18, 0x19, 0x1d, 0x1c, 0x1a, 0x23, 0x1f, 0x22, 0x21, 0x20]
665
- ]
666
- }
667
- };
668
- var convTables = {
669
- face3DSToWii: [0, 1, 2, 2, 3, 1, 4, 5, 4, 6, 7, 6],
670
- features3DSToWii: ["0", "6", 5, 6, "6", 4, 7, 7, 8, 10, "6", 11],//If typeof===String, choose a makeup in that field's place - there is no suitable replacement. Read the discrepancies in the README for more information.
671
- makeup3DSToWii: [0, 1, 1, 2, 1, 1, 2, 2, 2, 3, 9, 9],
672
- nose3DSToWii: [
673
- [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11],
674
- [0, 3, 4, 6, 9, 2]
675
- ],
676
- mouth3DSToWii: [
677
- ["111", "121", "131", "112", "122", "132", "113", "123", "133", "114", "124", "134"],
678
- ["211", "221", "231", "212", "222", "232", "213", "223", "233", "214", "224", "234"],
679
- ["121", "214", "134", "123", "121", "112", "124", "133", "221", "224", "121", "232"]
680
- ],
681
- hair3DSToWii: [
682
- [
683
- "111", "221", "121",
684
- "231", "211", "121",
685
- "212", "131", "233",
686
- "132", "112", "222"
687
- ],
688
- [
689
- "232", "223", "321",
690
- "123", "311", "134",
691
- "114", "124", "234",
692
- "114", "134", "234"
693
- ],
694
- [
695
- "214", "523", "433",
696
- "214", "531", "512",
697
- "523", "433", "134",
698
- "414", "523", "134"
699
- ],
700
- [
701
- "331", "333", "324",
702
- "332", "333", "334",
703
- "312", "322", "322",
704
- "113", "122", "313"
705
- ],
706
- [
707
- "113", "322", "133",
708
- "333", "323", "314",
709
- "411", "621", "521",
710
- "424", "424", "424"
711
- ],
712
- [
713
- "511", "411", "411",
714
- "422", "522", "523",
715
- "534", "523", "434",
716
- "422", "533", "424"
717
- ],
718
- [
719
- "511", "531", "534",
720
- "623", "521", "524",
721
- "534", "523", "523",
722
- "424", "513", "523"
723
- ],
724
- [
725
- "411", "523", "512",
726
- "513", "432", "432",
727
- "621", "431", "514",
728
- "421", "432", "514"
729
- ],
730
- [
731
- "623", "614", "633",
732
- "633", "633", "624",
733
- "434", "633", "634",
734
- "624", "624", "634"
735
- ],
736
- [
737
- "634", "413", "412",
738
- "413", "413", "412",
739
- "611", "622", "632",
740
- "611", "622", "632"
741
- ],
742
- [
743
- "423", "632", "423",
744
- "612", "612", "613",
745
- "631", "631", "613",
746
- "631", "631", "613"
747
- ]
748
- ],
749
- eyebrows3DSToWii: [
750
- [
751
- "111", "121", "131",
752
- "112", "122", "132",
753
- "113", "123", "133",
754
- "114", "124", "134"
755
- ],
756
- [
757
- "211", "221", "231",
758
- "212", "222", "232",
759
- "213", "223", "233",
760
- "214", "224", "234"
761
- ]
762
- ],
763
- eyes3DSToWii: [
764
- [
765
- "111", "121", "131",
766
- "112", "122", "132",
767
- "113", "123", "133",
768
- "114", "124", "134"
769
- ],
770
- [
771
- "211", "221", "231",
772
- "212", "222", "232",
773
- "213", "223", "233",
774
- "214", "224", "234"
775
- ],
776
- [
777
- "311", "321", "331",
778
- "312", "322", "332",
779
- "313", "323", "333",
780
- "314", "324", "334"
781
- ],
782
- [
783
- "411", "421", "431",
784
- "412", "422", "432",
785
- "413", "423", "433",
786
- "414", "424", "434"
787
- ],
788
- [
789
- "322", "322", "312",
790
- "224", "224", "431",
791
- "224", "224", "111",
792
- "121", "411", "431"
793
- ]
794
- ],
795
- hairWiiTo3DS: [
796
- [
797
- [0, 0], [0, 2], [0, 7],
798
- [0, 10], [3, 10], [0, 9],
799
- [4, 0], [1, 3], [3, 8],
800
- [1, 6], [1, 7], [1, 5]
801
- ],
802
- [
803
- [0, 4], [0, 1], [0, 3],
804
- [0, 6], [0, 11], [1, 0],
805
- [2, 5], [1, 1], [0, 8],
806
- [2, 0], [2, 6], [1, 8]
807
- ],
808
- [
809
- [1, 4], [1, 2], [3, 0],
810
- [4, 0], [3, 6], [3, 3],
811
- [3, 11], [4, 4], [4, 3],
812
- [4, 5], [3, 2], [3, 5]
813
- ],
814
- [
815
- [4, 6], [7, 9], [7, 7],
816
- [9, 5], [5, 9], [7, 5],
817
- [9, 1], [10, 2], [7, 0],
818
- [6, 1], [5, 8], [8, 9]
819
- ],
820
- [
821
- [5, 0], [6, 4], [2, 4],
822
- [4, 8], [5, 4], [5, 5],
823
- [6, 10], [6, 8], [5, 10],
824
- [7, 8], [6, 5], [6, 6]
825
- ],
826
- [
827
- [9, 6], [4, 7], [10, 6],
828
- [10, 1], [9, 10], [9, 8],
829
- [10, 8], [8, 1], [2, 0],
830
- [9, 1], [8, 9], [8, 8]
831
- ]
832
- ],
833
- faceWiiTo3DS: [
834
- 0, 1,
835
- 3, 4,
836
- 6, 7,
837
- 9, 10
838
- ],
839
- featureWiiTo3DS: [
840
- 0, "1", "6",
841
- "9", 5, 2,
842
- 3, 7, 8,
843
- "10", 9, 11
844
- ],
845
- formatTo: [
846
- [0, 1, 2],
847
- [3, 4, 5],
848
- [6, 7, 8],
849
- [9, 10, 11]
850
- ],
851
- formatFrom: [
852
- "11", "21", "31",
853
- "12", "22", "32",
854
- "13", "23", "33",
855
- "14", "24", "34"
856
- ]
857
- };
858
- const kidNames = {
859
- "Male": [
860
- "Aaron",
861
- "Adam",
862
- "Adrian",
863
- "Aiden",
864
- "Ayden",
865
- "Alex",
866
- "Alexander",
867
- "Alfie",
868
- "Andrew",
869
- "Anthony",
870
- "Archie",
871
- "Austin",
872
- "Ben",
873
- "Benjamin",
874
- "Bentley",
875
- "Bill",
876
- "Billy",
877
- "Blake",
878
- "Bradley",
879
- "Brandon",
880
- "Brayden",
881
- "Brody",
882
- "Bryson",
883
- "Caleb",
884
- "Callum",
885
- "Cameron",
886
- "Carlos",
887
- "Charlie",
888
- "Charles",
889
- "Carson",
890
- "Carter",
891
- "Chase",
892
- "Chris",
893
- "Christian",
894
- "Cody",
895
- "Colton",
896
- "Connor",
897
- "Cooper",
898
- "Damian",
899
- "Daniel",
900
- "David",
901
- "Dexter",
902
- "Dominic",
903
- "Dylan",
904
- "Easton",
905
- "Edward",
906
- "Eli",
907
- "Elijah",
908
- "Elliot",
909
- "Ethan",
910
- "Evan",
911
- "Finlay",
912
- "Frankie",
913
- "Freddie",
914
- "Gabriel",
915
- "Gavin",
916
- "George",
917
- "Grayson",
918
- "Harrison",
919
- "Harvey",
920
- "Henry",
921
- "Hudson",
922
- "Hugo",
923
- "Hunter",
924
- "Ian",
925
- "Isaac",
926
- "Isaiah",
927
- "Jace",
928
- "Jack",
929
- "Jackson",
930
- "Jaxon",
931
- "Jacob",
932
- "Jake",
933
- "James",
934
- "Jason",
935
- "Jayden",
936
- "Jenson",
937
- "Jeremiah",
938
- "John",
939
- "Juan",
940
- "Jonathan",
941
- "Jordan",
942
- "Jose",
943
- "Joseph",
944
- "Josiah",
945
- "Joshua",
946
- "Jude",
947
- "Julian",
948
- "Justin",
949
- "Kai",
950
- "Kayden",
951
- "Kevin",
952
- "Kian",
953
- "Landon",
954
- "Levi",
955
- "Leo",
956
- "Logan",
957
- "Lucas",
958
- "Luke",
959
- "Luis",
960
- "Lachlan",
961
- "Mason",
962
- "Matthew",
963
- "Max",
964
- "Michael",
965
- "Miguel",
966
- "Nathan",
967
- "Nathaniel",
968
- "Nicholas",
969
- "Noah",
970
- "Nolan",
971
- "Olly",
972
- "Oliver",
973
- "Owen",
974
- "Parker",
975
- "Philip",
976
- "Rhys",
977
- "Reece",
978
- "Rob",
979
- "Robert",
980
- "Ryan",
981
- "Ryder",
982
- "Samuel",
983
- "Sebastian",
984
- "Seth",
985
- "Thomas",
986
- "Tommy",
987
- "Trent",
988
- "Tristan",
989
- "Tyler",
990
- "William",
991
- "Liam",
992
- "Wyatt",
993
- "Xavier",
994
- "Zac",
995
- "Zachary",
996
- "Alex",
997
- "Alexis",
998
- "Angel",
999
- "Bailey",
1000
- "Darcy",
1001
- "Darcey",
1002
- "Genesis",
1003
- "Kennedy",
1004
- "Mackenzie",
1005
- "Morgan",
1006
- "Peyton",
1007
- "Sam",
1008
- "Taylor"
1009
- ],
1010
- "Female": [
1011
- "Aaliyah",
1012
- "Abigail",
1013
- "Addison",
1014
- "Madison",
1015
- "Maddison",
1016
- "Alexa",
1017
- "Alexandra",
1018
- "Alison",
1019
- "Allison",
1020
- "Alyssa",
1021
- "Amelia",
1022
- "Amy",
1023
- "Andrea",
1024
- "Anna",
1025
- "Annabelle",
1026
- "Aria",
1027
- "Ariana",
1028
- "Arianna",
1029
- "Ashley",
1030
- "Aubree",
1031
- "Aubrey",
1032
- "Audrey",
1033
- "Autumn",
1034
- "Ava",
1035
- "Avery",
1036
- "Bella",
1037
- "Bethany",
1038
- "Brianna",
1039
- "Brooklyn",
1040
- "Camila",
1041
- "Caroline",
1042
- "Charlotte",
1043
- "Chloe",
1044
- "Khloe",
1045
- "Claire",
1046
- "Ella",
1047
- "Ellie",
1048
- "Elenor",
1049
- "Elizabeth",
1050
- "Lizabeth",
1051
- "Liza",
1052
- "Emily",
1053
- "Emma",
1054
- "Eva",
1055
- "Evie",
1056
- "Evelyn",
1057
- "Faith",
1058
- "Gabriella",
1059
- "Gianna",
1060
- "Grace",
1061
- "Hailey",
1062
- "Hannah",
1063
- "Harper",
1064
- "Heidi",
1065
- "Hollie",
1066
- "Holly",
1067
- "Isabella",
1068
- "Isobel",
1069
- "Jasmine",
1070
- "Jessica",
1071
- "Jocelyn",
1072
- "Julia",
1073
- "Katherine",
1074
- "Kayla",
1075
- "Kaylee",
1076
- "Kimberly",
1077
- "Kylie",
1078
- "Lacey",
1079
- "Lauren",
1080
- "Layla",
1081
- "Leah",
1082
- "Lexie",
1083
- "Lilian",
1084
- "Lily",
1085
- "Lola",
1086
- "London",
1087
- "Lucy",
1088
- "Lydia",
1089
- "Madeline",
1090
- "Madelyn",
1091
- "Maisie",
1092
- "Makayla",
1093
- "Maya",
1094
- "Mya",
1095
- "Megan",
1096
- "Melanie",
1097
- "Mia",
1098
- "Molly",
1099
- "Naomi",
1100
- "Natalie",
1101
- "Nevaeh",
1102
- "Olivia",
1103
- "Paige",
1104
- "Poppy",
1105
- "Piper",
1106
- "Reagan",
1107
- "Rebecca",
1108
- "Riley",
1109
- "Rosie",
1110
- "Samantha",
1111
- "Sarah",
1112
- "Savannah",
1113
- "Scarlett",
1114
- "Serenity",
1115
- "Skye",
1116
- "Skylar",
1117
- "Sofia",
1118
- "Sophia",
1119
- "Sophie",
1120
- "Spring",
1121
- "Stella",
1122
- "Summer",
1123
- "Sydney",
1124
- "Trinity",
1125
- "Vanessa",
1126
- "Victoria",
1127
- "Violet",
1128
- "Winter",
1129
- "Zara",
1130
- "Zoe",
1131
- "Zoey",
1132
- "Alex",
1133
- "Alexis",
1134
- "Angel",
1135
- "Bailey",
1136
- "Darcy",
1137
- "Darcey",
1138
- "Genesis",
1139
- "Kennedy",
1140
- "Mackenzie",
1141
- "Morgan",
1142
- "Peyton",
1143
- "Sam",
1144
- "Taylor"
1145
- ]
1146
- };
28
+ const {lookupTables,convTables,defaultInstrs,childGenTables}=require("./data.json");
1147
29
 
1148
30
  //Tools
1149
31
  function Uint8Cat() {
@@ -1248,7 +130,6 @@ const findPageType = (table2D, id) => {
1248
130
  }
1249
131
  return { page: 0, type: 0 };
1250
132
  };
1251
- const clamp = (x, lo, hi) => Math.max(lo, Math.min(hi, x));
1252
133
 
1253
134
  //If FFLResHigh.dat is in the same directory as Node.js is calling the library from, use it by default
1254
135
  let _fflRes;
@@ -1327,371 +208,6 @@ function encodeAesCcm(data) {
1327
208
  return Uint8Cat(cfsd.subarray(NONCE_OFFSET, NONCE_OFFSET + NONCE_LENGTH), ciphertext.subarray(0, ciphertext.length - 24), ciphertext.subarray(ciphertext.length - TAG_LENGTH, ciphertext.length))
1328
209
  }
1329
210
 
1330
- //Defaults
1331
- const defaultInstrs = {
1332
- wii: {
1333
- male: {
1334
- "col": "On the info page (first tab), set the Favorite Color to Red (1 from the left, top row).",
1335
- "heightWeight": "On the build page (second tab), set the height to 50%, and the weight to 50%.",
1336
- "faceShape": "On the face page (third tab), set the shape to the one 1 from the top, in the left column.",
1337
- "skinCol": "On the face page (third tab), set the color to the one 1 from the left, on the top row.",
1338
- "makeup": "On the face page's makeup tab, set the makeup to \"None\" (the one 1 from the top, and 1 from the left).",
1339
- "hairStyle": "On the hair page (fourth tab), set the hair style to the one 1 from the left, 1 from the top, on page 1.",
1340
- "hairFlipped": "",
1341
- "hairColor": "On the hair page (fourth tab), set the hair color to the one 2 from the left, on the top row.",
1342
- "eyebrowStyle": "On the eyebrow page (fifth tab), set the eyebrow style to the one 1 from the left, 1 from the top, on page 1.",
1343
- "eyebrowColor": "On the eyebrow page (fifth tab), set the eyebrow color to the one 2 from the left, on the top row.",
1344
- "eyebrowY": "",
1345
- "eyebrowSize": "",
1346
- "eyebrowRot": "",
1347
- "eyebrowDist": "",
1348
- "eyeType": "On the eye page (sixth tab), set the eye type to the one 1 from the left, 1 from the top, on page 1.",
1349
- "eyeColor": "On the eye page (sixth tab), set the color to the one 1 from the left, on the top row.",
1350
- "eyeY": "",
1351
- "eyeSize": "",
1352
- "eyeRot": "",
1353
- "eyeDist": "",
1354
- "noseType": "On the nose page (seventh tab), set the nose to the one 1 from the top, and 1 from the left.",
1355
- "noseY": "",
1356
- "noseSize": "",
1357
- "mouthType": "On the mouth page (eighth tab), set the mouth type to the one 1 from the left, 1 from the top, on page 1.",
1358
- "mouthCol": "On the mouth page (eighth tab), set the color to the one 1 from the left.",
1359
- "mouthY": "",
1360
- "mouthSize": "",
1361
- "glasses": "On the glasses page (within the ninth tab), set the glasses to the one 1 from the top, and 1 from the left.",
1362
- "glassesCol": "On the glasses page (within the ninth tab), set the color to the one 1 from the left, on the top row.",
1363
- "glassesY": "",
1364
- "glassesSize": "",
1365
- "stache": "On the mustache page (within the ninth tab), set the mustache to the one on the top-left.",
1366
- "stacheY": "",
1367
- "stacheSize": "",
1368
- "mole": "",
1369
- "moleX": "",
1370
- "moleY": "",
1371
- "moleSize": "",
1372
- "beard": "On the beard page (within the ninth tab), set the beard to the one on the top-left.",
1373
- "beardCol": "On the mustache OR beard pages (within the ninth tab), set the color to the one 1 from the left, on the top row."
1374
- },
1375
- female: {
1376
- "col": "On the info page (first tab), set the Favorite Color to Red (1 from the left, top row).",
1377
- "heightWeight": "On the build page (second tab), set the height to 50%, and the weight to 50%.",
1378
- "faceShape": "On the face page (third tab), set the shape to the one 1 from the top, in the left column.",
1379
- "skinCol": "On the face page (third tab), set the color to the one 1 from the left, on the top row.",
1380
- "makeup": "On the face page's makeup tab, set the makeup to \"None\" (the one 1 from the top, and 1 from the left).",
1381
- "hairStyle": "On the hair page (fourth tab), set the hair style to the one 1 from the left, 1 from the top, on page 4.",
1382
- "hairFlipped": "",
1383
- "hairColor": "On the hair page (fourth tab), set the hair color to the one 2 from the left, on the top row.",
1384
- "eyebrowStyle": "On the eyebrow page (fifth tab), set the eyebrow style to the one 2 from the left, 1 from the top, on page 1.",
1385
- "eyebrowColor": "On the eyebrow page (fifth tab), set the eyebrow color to the one 2 from the left, on the top row.",
1386
- "eyebrowY": "",
1387
- "eyebrowSize": "",
1388
- "eyebrowRot": "",
1389
- "eyebrowDist": "",
1390
- "eyeType": "On the eye page (sixth tab), set the eye type to the one 2 from the left, 1 from the top, on page 1.",
1391
- "eyeColor": "On the eye page (sixth tab), set the color to the one 1 from the left, on the top row.",
1392
- "eyeY": "",
1393
- "eyeSize": "",
1394
- "eyeRot": "On the eye page (sixth tab), press the rotate clockwise button 1 times.",
1395
- "eyeDist": "",
1396
- "noseType": "On the nose page (seventh tab), set the nose to the one 0 from the top, and 1 from the left.",
1397
- "noseY": "",
1398
- "noseSize": "",
1399
- "mouthType": "On the mouth page (eighth tab), set the mouth type to the one 1 from the left, 1 from the top, on page 1.",
1400
- "mouthCol": "On the mouth page (eighth tab), set the color to the one 1 from the left.",
1401
- "mouthY": "",
1402
- "mouthSize": "",
1403
- "glasses": "On the glasses page (within the ninth tab), set the glasses to the one 1 from the top, and 1 from the left.",
1404
- "glassesCol": "On the glasses page (within the ninth tab), set the color to the one 1 from the left, on the top row.",
1405
- "glassesY": "",
1406
- "glassesSize": "",
1407
- "stache": "On the mustache page (within the ninth tab), set the mustache to the one on the top-left.",
1408
- "stacheY": "",
1409
- "stacheSize": "",
1410
- "mole": "",
1411
- "moleX": "",
1412
- "moleY": "",
1413
- "moleSize": "",
1414
- "beard": "On the beard page (within the ninth tab), set the beard to the one on the top-left.",
1415
- "beardCol": "On the mustache OR beard pages (within the ninth tab), set the color to the one 1 from the left, on the top row."
1416
- }
1417
- },
1418
- "3ds": {
1419
- "male": {
1420
- "faceShape": "On the face page (first tab), set the face shape to the one 1 from the top, and 1 from the left.",
1421
- "skinCol": "On the face page (first tab), set the color to the one 1 from the top.",
1422
- "makeup": "On the face page's makeup tab, set the makeup to \"None\" (the one 1 from the top, and 1 from the left).",
1423
- "feature": "On the face page's wrinkles tab, set the facial feature to \"None\" (the one 2 from the top, and 1 from the left).",
1424
- "hairStyle": "On the hair page (second tab), set the hair style to the one 1 from the top, and 1 from the left, on page 1.",
1425
- "hairFlipped": "",
1426
- "hairColor": "On the hair page (second tab), set the hair color to the one 2 from the top.",
1427
- "eyebrowStyle": "On the eyebrow page (third tab), set the eyebrow style to the one 1 from the left, 1 from the top, on page 1.",
1428
- "eyebrowColor": "On the eyebrow page (third tab), set the eyebrow color to the one 2 from the top.",
1429
- "eyebrowY": "",
1430
- "eyebrowSize": "",
1431
- "eyebrowRot": "",
1432
- "eyebrowDist": "",
1433
- "eyebrowSquash": "",
1434
- "eyeType": "On the eye page (fourth tab), set the eye type to the one 1 from the left, 1 from the top, on page 1.",
1435
- "eyeColor": "On the eye page (fourth tab), set the color to the one 1 from the top.",
1436
- "eyeY": "",
1437
- "eyeSize": "",
1438
- "eyeRot": "",
1439
- "eyeDist": "",
1440
- "eyeSquash": "",
1441
- "noseType": "On the nose page (fifth tab), set the nose to the one 1 from the top, and 1 from the left, on page 0.",
1442
- "noseY": "",
1443
- "noseSize": "",
1444
- "mouthType": "On the mouth page (sixth tab), set the mouth type to the one 1 from the left, 1 from the top, on page 1.",
1445
- "mouthCol": "On the mouth page (sixth tab), set the color to the one 1 from the top.",
1446
- "mouthY": "",
1447
- "mouthSize": "",
1448
- "mouthSquash": "",
1449
- "glasses": "On the glasses page (within the seventh tab), set the glasses to the one 1 from the top, and 1 from the left.",
1450
- "glassesCol": "On the glasses page (within the seventh tab), set the color to the one 1 from the top.",
1451
- "glassesY": "",
1452
- "glassesSize": "",
1453
- "stache": "On the mustache page (within the seventh tab), set the mustache to the one on the top-left.",
1454
- "stacheY": "",
1455
- "stacheSize": "",
1456
- "mole": "",
1457
- "moleX": "",
1458
- "moleY": "",
1459
- "moleSize": "",
1460
- "beard": "On the beard page (within the seventh tab), set the beard to the one on the top-left.",
1461
- "beardCol": "On the mustache OR beard pages (within the seventh tab), set the color to the one 1 from the top.",
1462
- "heightWeight": "On the build page (eighth tab), set the height to 50%, and the weight to 50%.",
1463
- "col": "On the info page (after pressing \"Next\"), set the Favorite Color to Red (1 from the left, top row)."
1464
- },
1465
- "female": {
1466
- "faceShape": "On the face page (first tab), set the face shape to the one 1 from the top, and 1 from the left.",
1467
- "skinCol": "On the face page (first tab), set the color to the one 1 from the top.",
1468
- "makeup": "On the face page's makeup tab, set the makeup to \"None\" (the one 1 from the top, and 1 from the left).",
1469
- "feature": "On the face page's wrinkles tab, set the facial feature to \"None\" (the one 2 from the top, and 1 from the left).",
1470
- "hairStyle": "On the hair page (second tab), set the hair style to the one 3 from the top, and 1 from the left, on page 5.",
1471
- "hairFlipped": "",
1472
- "hairColor": "On the hair page (second tab), set the hair color to the one 2 from the top.",
1473
- "eyebrowStyle": "On the eyebrow page (third tab), set the eyebrow style to the one 2 from the left, 1 from the top, on page 1.",
1474
- "eyebrowColor": "On the eyebrow page (third tab), set the eyebrow color to the one 2 from the top.",
1475
- "eyebrowY": "",
1476
- "eyebrowSize": "",
1477
- "eyebrowRot": "",
1478
- "eyebrowDist": "",
1479
- "eyebrowSquash": "",
1480
- "eyeType": "On the eye page (fourth tab), set the eye type to the one 2 from the left, 1 from the top, on page 1.",
1481
- "eyeColor": "On the eye page (fourth tab), set the color to the one 1 from the top.",
1482
- "eyeY": "",
1483
- "eyeSize": "",
1484
- "eyeRot": "",
1485
- "eyeDist": "",
1486
- "eyeSquash": "",
1487
- "noseType": "On the nose page (fifth tab), set the nose to the one 1 from the top, and 1 from the left, on page 0.",
1488
- "noseY": "",
1489
- "noseSize": "",
1490
- "mouthType": "On the mouth page (sixth tab), set the mouth type to the one 1 from the left, 1 from the top, on page 1.",
1491
- "mouthCol": "On the mouth page (sixth tab), set the color to the one 1 from the top.",
1492
- "mouthY": "",
1493
- "mouthSize": "",
1494
- "mouthSquash": "",
1495
- "glasses": "On the glasses page (within the seventh tab), set the glasses to the one 1 from the top, and 1 from the left.",
1496
- "glassesCol": "On the glasses page (within the seventh tab), set the color to the one 1 from the top.",
1497
- "glassesY": "",
1498
- "glassesSize": "",
1499
- "stache": "On the mustache page (within the seventh tab), set the mustache to the one on the top-left.",
1500
- "stacheY": "",
1501
- "stacheSize": "",
1502
- "mole": "",
1503
- "moleX": "",
1504
- "moleY": "",
1505
- "moleSize": "",
1506
- "beard": "On the beard page (within the seventh tab), set the beard to the one on the top-left.",
1507
- "beardCol": "On the mustache OR beard pages (within the seventh tab), set the color to the one 1 from the top.",
1508
- "heightWeight": "On the build page (eighth tab), set the height to 50%, and the weight to 50%.",
1509
- "col": "On the info page (after pressing \"Next\"), set the Favorite Color to Red (1 from the left, top row)."
1510
- }
1511
- }
1512
- };
1513
-
1514
- const defaultMii = {
1515
- "male": {
1516
- "general": {
1517
- "type": 3,
1518
- "birthday": 17,
1519
- "birthMonth": 4,
1520
- "height": 0,
1521
- "weight": 0,
1522
- "gender": 1,
1523
- "favoriteColor": 7
1524
- },
1525
- "meta": {
1526
- "name": "Madison",
1527
- "creatorName": "",
1528
- "console": "3ds"
1529
- },
1530
- "perms": {
1531
- "sharing": false,
1532
- "copying": true,
1533
- "fromCheckMiiOut": false,
1534
- "mingle": true
1535
- },
1536
- "hair": {
1537
- "page": 0,
1538
- "type": 7,
1539
- "color": 7,
1540
- "flipped": false
1541
- },
1542
- "face": {
1543
- "type": 5,
1544
- "color": 0,
1545
- "feature": 0,
1546
- "makeup": 0
1547
- },
1548
- "eyes": {
1549
- "page": 0,
1550
- "type": 9,
1551
- "col": 4,
1552
- "size": 1,
1553
- "squash": 3,
1554
- "rotation": 4,
1555
- "distanceApart": 3,
1556
- "yPosition": 11
1557
- },
1558
- "eyebrows": {
1559
- "page": 0,
1560
- "type": 5,
1561
- "color": 7,
1562
- "size": 2,
1563
- "squash": 4,
1564
- "rotation": 4,
1565
- "distanceApart": 4,
1566
- "yPosition": 6
1567
- },
1568
- "nose": {
1569
- "page": 1,
1570
- "type": 0,
1571
- "size": 0,
1572
- "yPosition": 5
1573
- },
1574
- "mouth": {
1575
- "page": 1,
1576
- "type": 6,
1577
- "color": 0,
1578
- "size": 2,
1579
- "squash": 3,
1580
- "yPosition": 10
1581
- },
1582
- "beard": {
1583
- "mustache": {
1584
- "type": 0,
1585
- "size": 4,
1586
- "yPosition": 10
1587
- },
1588
- "col": 0,
1589
- "type": 0
1590
- },
1591
- "glasses": {
1592
- "type": 0,
1593
- "color": 0,
1594
- "size": 4,
1595
- "yPosition": 10
1596
- },
1597
- "mole": {
1598
- "on": false,
1599
- "size": 4,
1600
- "xPosition": 2,
1601
- "yPosition": 20
1602
- }
1603
- },
1604
- "female": {
1605
- "general": {
1606
- "type": 3,
1607
- "birthday": 17,
1608
- "birthMonth": 4,
1609
- "height": 0,
1610
- "weight": 0,
1611
- "gender": 1,
1612
- "favoriteColor": 7
1613
- },
1614
- "meta": {
1615
- "name": "Madison",
1616
- "creatorName": "",
1617
- "console": "3ds"
1618
- },
1619
- "perms": {
1620
- "sharing": false,
1621
- "copying": true,
1622
- "fromCheckMiiOut": false,
1623
- "mingle": true
1624
- },
1625
- "hair": {
1626
- "page": 0,
1627
- "type": 7,
1628
- "color": 7,
1629
- "flipped": false
1630
- },
1631
- "face": {
1632
- "type": 5,
1633
- "color": 0,
1634
- "feature": 0,
1635
- "makeup": 0
1636
- },
1637
- "eyes": {
1638
- "page": 0,
1639
- "type": 9,
1640
- "col": 4,
1641
- "size": 1,
1642
- "squash": 3,
1643
- "rotation": 4,
1644
- "distanceApart": 3,
1645
- "yPosition": 11
1646
- },
1647
- "eyebrows": {
1648
- "page": 0,
1649
- "type": 5,
1650
- "color": 7,
1651
- "size": 2,
1652
- "squash": 4,
1653
- "rotation": 4,
1654
- "distanceApart": 4,
1655
- "yPosition": 6
1656
- },
1657
- "nose": {
1658
- "page": 1,
1659
- "type": 0,
1660
- "size": 0,
1661
- "yPosition": 5
1662
- },
1663
- "mouth": {
1664
- "page": 1,
1665
- "type": 6,
1666
- "color": 0,
1667
- "size": 2,
1668
- "squash": 3,
1669
- "yPosition": 10
1670
- },
1671
- "beard": {
1672
- "mustache": {
1673
- "type": 0,
1674
- "size": 4,
1675
- "yPosition": 10
1676
- },
1677
- "col": 0,
1678
- "type": 0
1679
- },
1680
- "glasses": {
1681
- "type": 0,
1682
- "color": 0,
1683
- "size": 4,
1684
- "yPosition": 10
1685
- },
1686
- "mole": {
1687
- "on": false,
1688
- "size": 4,
1689
- "xPosition": 2,
1690
- "yPosition": 20
1691
- }
1692
- }
1693
- };
1694
-
1695
211
  //Functions for working with the Miis
1696
212
  function encodeStudio(mii) {
1697
213
  var n = 0;
@@ -2518,7 +1034,7 @@ async function createFFLMiiIcon(data, options, shirtColor, fflRes) {
2518
1034
  body.userData.isMiiBody = true;
2519
1035
 
2520
1036
  // Recolor body (bakes into texture)
2521
- var pantsColor=[0x808080,0xFFC000,0x89CFF0,0x913831,0x913831][["default","special","foreign","favorite","favorited"].indexOf(options.pantsType?.toLowerCase()||"default")];
1037
+ var pantsColor = [0x808080, 0xFFC000, 0x89CFF0, 0x913831, 0x913831][["default", "special", "foreign", "favorite", "favorited"].indexOf(options.pantsType?.toLowerCase() || "default")];
2522
1038
  body.traverse((o) => {
2523
1039
  if (o.isMesh) {
2524
1040
  if (!o.geometry.attributes.normal) o.geometry.computeVertexNormals();
@@ -2676,7 +1192,7 @@ async function createFFLMiiIcon(data, options, shirtColor, fflRes) {
2676
1192
  cropBottom = Math.max(0, Math.min(height - 1, bottomPx + (options.fullBodyCropExtraBottomPx ?? 0)));
2677
1193
 
2678
1194
  // Output with bottom crop applied (no top crop)
2679
- const outH = Math.max(1, isFullBody?height - cropBottom:450);
1195
+ const outH = Math.max(1, isFullBody ? height - cropBottom : 450);
2680
1196
  const outCanvas = createCanvas(width, outH);
2681
1197
  const ctxOut = outCanvas.getContext("2d");
2682
1198
 
@@ -2714,7 +1230,7 @@ async function renderMii(jsonIn, options = {}, fflRes = getFFLRes()) {
2714
1230
  gender: jsonIn.general.gender,
2715
1231
  height: jsonIn.general.height,
2716
1232
  weight: jsonIn.general.weight,
2717
- pantsType: jsonIn.meta?.type||"Default"
1233
+ pantsType: jsonIn.meta?.type || "Default"
2718
1234
  });
2719
1235
 
2720
1236
  return createFFLMiiIcon(studioMii, options, jsonIn.general.favoriteColor, fflRes);
@@ -3050,67 +1566,175 @@ async function write3DSQR(miiJson, outPath, returnBin, fflRes = getFFLRes()) {
3050
1566
 
3051
1567
  return imageBuffer;
3052
1568
  }
3053
- function make3DSChild(dad, mom, options = {}) {
3054
- if (!["3ds", "wii u"].includes(dad.meta.console?.toLowerCase())) {
3055
- dad = convertMii(dad, "wii");
3056
- }
3057
- if (!["3ds", "wii u"].includes(mom.meta.console?.toLowerCase())) {
3058
- mom = convertMii(dad, "wii");
3059
- }
3060
- var g = options.gender || Math.floor(Math.random() * 2);
3061
- var child = {
3062
- "general": {
3063
- "birthMonth": new Date().getMonth() + 1,
3064
- "birthday": new Date().getDay(),
3065
- "height": 64,
3066
- "weight": 64,
3067
- "gender": g,
3068
- "favoriteColor": options.favoriteColor || favCols[Math.floor(Math.random() * favCols.length)]
3069
- },
3070
- "meta": {
3071
- "name": options.name || kidNames[g][Math.floor(Math.random() * kidNames[g].length)],
3072
- "creatorName": "",
3073
- },
3074
- "perms": {
3075
- "sharing": true,
3076
- "copying": true
3077
- },
3078
- "hair": {
3079
- "page": 8,//Hardcoded, needs to be generated
3080
- "type": 3,// ^
3081
- "color": Math.floor(Math.random() * 2) === 1 ? dad.hair.color : mom.hair.color,
3082
- "flipped": Math.floor(Math.random() * 2) === 0 ? true : false
3083
- },
3084
- "face": {
3085
- "shape": Math.floor(Math.random() * 2) === 1 ? dad.face.shape : mom.face.shape,
3086
- "feature": Math.floor(Math.random() * 2) === 1 ? dad.face.feature : mom.face.feature,
3087
- "makeup": g === 0 ? 0 : Math.floor(Math.random() * 2) === 1 ? dad.face.makeup : mom.face.makeup
3088
- },
3089
- "eyes": Math.floor(Math.random() * 2) === 1 ? dad.eyes : mom.eyes,
3090
- "eyebrows": Math.floor(Math.random() * 2) === 1 ? dad.eyebrows : mom.eyebrows,
3091
- "nose": Math.floor(Math.random() * 2) === 1 ? dad.nose : mom.nose,
3092
- "mouth": Math.floor(Math.random() * 2) === 1 ? dad.mouth : mom.mouth,
3093
- "beard": {//Beards can never be generated for children allegedly, confirm before finishing
3094
- "mustache": {
3095
- "type": 0,
3096
- "mustacheSize": 4,
3097
- "mustacheYPos": 10
3098
- },
3099
- "type": 0,
3100
- "color": 0
3101
- },
3102
- "glasses": Math.floor(Math.random() * 2) === 1 ? dad.glasses : mom.glasses,
3103
- "mole": Math.floor(Math.random() * 2) === 1 ? dad.mole : mom.mole
3104
- };
1569
+ function makeChild(parent0, parent1, options) {
1570
+ if(parent0.console.toLowerCase()==="wii") parent0=convertMii(parent0,"3DS");
1571
+ if(parent1.console.toLowerCase()==="wii") parent1=convertMii(parent1,"3DS");
1572
+
1573
+ var randomBytes = [];
1574
+ for (var i = 0; i < 8; i++) {
1575
+ //randomBytes[1] is never used, kept here purely for an interesting detail from research
1576
+ randomBytes.push(Math.floor(Math.random() * 2));
1577
+ }
1578
+
1579
+ var mainParent = randomBytes[0] === 1 ? parent1 : parent0;
1580
+ var child = structuredClone(mainParent);//We have to clear some defaults doing it this way, but so much of the Mii gen is from this parent it's just quicker to gen this way.
1581
+
1582
+ //Clear some things children don't have or process
1583
+ child.beard.type=0;
1584
+ child.beard.mustache.type=0;
1585
+ child.face.feature=0;
1586
+ child.face.makeup=0;
1587
+ child.glasses.type=0;//For parity with the original, I can find no evidence of child Miis with glasses nor did I find anything referencing glasses processing in research
1588
+ child.hair.flipped=false;//Just for full parity with the original
1589
+ child.console="3DS";
1590
+ child.perms.sharing=parent0.perms.sharing&&parent1.perms.sharing;//Why not?
1591
+ child.perms.copying=parent0.perms.copying&&parent1.perms.copying;//Why not?
1592
+
1593
+ var birthday=new Date();
1594
+ child.general.birthday=birthday.getDate();
1595
+ child.general.birthMonth=birthday.getMonth()+1;
1596
+ child.meta.creatorName=options?.hasOwnProperty("creatorName")?options.creatorName:"";
1597
+ child.meta.type="Default";
1598
+
1599
+ var gender = options?.hasOwnProperty("gender") ? options.gender : Math.floor(Math.random() * 2);
1600
+ child.general.gender = gender;
1601
+ child.meta.name = options?.hasOwnProperty("name")? options.name : childGenTables.names[child.general.gender][Math.floor(Math.random() * childGenTables.names[child.general.gender].length)];
1602
+
1603
+ var matchingParent = parent0.general.gender === gender ? parent0 : parent1;
1604
+ var mainParentFlag = (matchingParent === parent0) ? 0 : 1;
1605
+
1606
+ //Skin color mixing. Intuitively you'd think they'd order them by similarity and pick an average, but no they have an entire table of what skin colors product what child skin color
1607
+ var validValues = childGenTables.skinColorMixing[Math.min(parent0.face.color, parent1.face.color)][Math.max(parent0.face.color, parent1.face.color)].filter(v => v !== -1);
1608
+ child.face.color = validValues[Math.floor(Math.random() * validValues.length)];
1609
+
1610
+ //Each child is sorted into groups of potential hairstyles based on the hairstyle of the parent of the same gender of the child, and then a random hair is selected from that pool at each stage of life
1611
+ var hairGroupIndex = childGenTables.hairStyleGroupMappings[lookupTables.hairs.values[matchingParent.hair.page][matchingParent.hair.type]][gender];
1612
+ child.hair.color = randomBytes[2] === 0 ? parent0.hair.color : parent1.hair.color;
1613
+
1614
+ child.eyes.page = randomBytes[3] === 0 ? parent0.eyes.page : parent1.eyes.page;
1615
+ child.eyes.type = randomBytes[3] === 0 ? parent0.eyes.type : parent1.eyes.type;
1616
+ child.eyes.color = randomBytes[4] === 0 ? parent0.eyes.color : parent1.eyes.color;
1617
+
1618
+ child.eyebrows.page = matchingParent.eyebrows.page;
1619
+ child.eyebrows.type = matchingParent.eyebrows.type;
1620
+
1621
+ child.face.color = [7, 7, 6, 7][Math.min(child.face.color, 3)];
1622
+
3105
1623
  child.eyebrows.color = child.hair.color;
3106
- var c = [mom.face.color, dad.face.color];
3107
- if (c[0] > c[1]) {
3108
- c[1] = c[0];
3109
- c[0] = dad.face.color;
3110
- }
3111
- child.face.color = c[0] + Math.round((c[1] - c[0]) / 2);
3112
- child.type = "3DS";
3113
- return child;
1624
+
1625
+ child.nose.page = randomBytes[5] === 0 ? parent0.nose.page : parent1.nose.page;
1626
+ child.nose.type = randomBytes[5] === 0 ? parent0.nose.type : parent1.nose.type;
1627
+
1628
+ child.mouth.page = randomBytes[6] === 0 ? parent0.mouth.page : parent1.mouth.page;
1629
+ child.mouth.type = randomBytes[6] === 0 ? parent0.mouth.type : parent1.mouth.type;
1630
+ child.mouth.color = randomBytes[7] === 0 ? parent0.mouth.color : parent1.mouth.color;
1631
+
1632
+ child.mole.on = Math.floor(Math.random() * 2) === 0 ? parent0.mole.on : parent1.mole.on;
1633
+
1634
+ //Child Miis generate the last stage, then build offsets backwards through the younger stages of life starting at the older stages
1635
+ var eyeBase = Math.min(Math.max(child.eyes.yPosition + 2, 0), 18);
1636
+ let browBase = child.eyebrows.yPosition + 2;
1637
+ if (browBase >= 18) {
1638
+ browBase = 18;
1639
+ }
1640
+ else if (browBase < 4) {
1641
+ browBase = 3;
1642
+ }
1643
+
1644
+ var mouthBase = Math.min(Math.max(child.mouth.yPosition - 2, 0), 18);
1645
+
1646
+ var eyeYDelta = child.eyes.yPosition - eyeBase;
1647
+ var browYDelta = child.eyebrows.yPosition - browBase;
1648
+ var mouthYDelta = child.mouth.yPosition - mouthBase;
1649
+ var noseSizeDelta = child.nose.size;
1650
+
1651
+ //This should be a 1:1 of final stage height and weight generation
1652
+ var heightParent = Math.floor(Math.random() * 2) === 0 ? parent0 : parent1;
1653
+ var height = (heightParent.general.height >> 3) * 1.4;
1654
+ height *= 1.4 * 1.4;
1655
+ height *= 1.4 * 1.4;
1656
+ child.general.height = Math.round(Math.min(Math.max(height, 0), 127));
1657
+
1658
+ var weightParent = Math.floor(Math.random() * 2) === 0 ? parent0 : parent1;
1659
+ let weight = Math.trunc((weightParent.general.weight + 1) / 4) + 48;
1660
+ for (var iAdj = 0; iAdj < 5; iAdj++) {
1661
+ weight += (weight - 64.0) * 0.2;
1662
+ }
1663
+ child.general.weight = Math.round(Math.min(Math.max(weight, 0), 127));
1664
+
1665
+ child.general.favoriteColor=options?.favoriteColor?options.favoriteColor:(child.general.gender==0?[2,3,5,6]:[0,1,7,8])[Math.floor(Math.random()*4)];//We're not running personality generation here, so we're just making a random color of the personality groups the child had available so as to add some variety to the colors
1666
+
1667
+ //Now we take the baselines above and translate them into the younger years
1668
+ child.stages = [];
1669
+ for (var iStage = 0; iStage < 6; iStage++) {
1670
+ child.stages.push(structuredClone(child));
1671
+
1672
+ child.stages[iStage].eyes.yPosition=Math.floor((eyeYDelta * iStage)/5) + eyeBase;
1673
+ child.stages[iStage].eyebrows.yPosition=Math.floor((browYDelta * iStage)/5) + browBase;
1674
+ child.stages[iStage].mouth.yPosition=Math.floor((mouthYDelta * iStage)/5) + mouthBase;
1675
+ child.stages[iStage].nose.size=Math.floor((noseSizeDelta * iStage)/5);
1676
+
1677
+ if(iStage<4){
1678
+ child.stages[iStage].face.type=5;//Extra technically, I'm fairly certain this still happens just in a different part than I directly researched
1679
+ }
1680
+
1681
+ child.stages[iStage].general.height=Math.floor((child.stages[iStage].general.height/5)*iStage);//Extra, Tomodachi Life just uses alternate models and therefore no official height growth is in-game yet one is displayed, so I mocked up a basic growing up height. Newborn will always be the shortest, stage 5 will always be the actual height, and the values in between are just a range in between. We don't do the same for weight since Mii weights appear to be more of a representative of underweight or overweight for the height.
1682
+
1683
+ delete child.stages[iStage].stages;//Because we're just cloning the baseline object repeatedly to make the stages a little bit cleaner, we need to clear this on subsequent clones
1684
+ }
1685
+
1686
+ //If this looks odd, it is setup in a specific way to mimic the research I did into hair generation as 1:1 as possible
1687
+ let ageGroup = 0;
1688
+ for (let iHairStage = 0; iHairStage < 4; iHairStage++) {
1689
+ const subgroup = childGenTables.hairStyleGroups[hairGroupIndex][ageGroup];
1690
+ const style = subgroup[Math.floor(Math.random() * subgroup.length)];
1691
+ const hairLookup = lookupTable("hairs", style, true);
1692
+ if (!hairLookup) continue;
1693
+ const [hairPage, hairType] = hairLookup;
1694
+ switch(iHairStage){
1695
+ case 0:
1696
+ child.stages[0].hair.page = hairPage;
1697
+ child.stages[0].hair.type = hairType;
1698
+ break;
1699
+ case 1:
1700
+ child.stages[1].hair.page = hairPage;
1701
+ child.stages[1].hair.type = hairType;
1702
+ child.stages[2].hair.page = hairPage;
1703
+ child.stages[2].hair.type = hairType;
1704
+ break;
1705
+ case 2:
1706
+ child.stages[3].hair.page = hairPage;
1707
+ child.stages[3].hair.type = hairType;
1708
+ child.stages[4].hair.page = hairPage;
1709
+ child.stages[4].hair.type = hairType;
1710
+ break;
1711
+ case 3:
1712
+ child.stages[5].hair.page = hairPage;
1713
+ child.stages[5].hair.type = hairType;
1714
+ break;
1715
+ }
1716
+ if (mainParentFlag === 0) {
1717
+ if (iHairStage === 0) {
1718
+ ageGroup = Math.min(ageGroup + 1, 3);
1719
+ }
1720
+ else {
1721
+ if (Math.floor(Math.random() * 3) !== 0) {
1722
+ ageGroup = Math.min(ageGroup + 1, 3);
1723
+ }
1724
+ }
1725
+ }
1726
+ else {
1727
+ if (iHairStage === 0) {
1728
+ ageGroup = Math.min(ageGroup + 1, 3);
1729
+ }
1730
+ else {
1731
+ if (Math.floor(Math.random() * 4) !== 0) {
1732
+ ageGroup = Math.min(ageGroup + 1, 3);
1733
+ }
1734
+ }
1735
+ }
1736
+ }
1737
+ return child.stages;
3114
1738
  }
3115
1739
  function generateInstructions(mii, full) {
3116
1740
  let type = mii.console?.toLowerCase();
@@ -3233,19 +1857,19 @@ function generateInstructions(mii, full) {
3233
1857
  function miiHeightToMeasurements(value) {
3234
1858
  // h in [0, 127]
3235
1859
  const totalInches = 36 + (48 / 127) * value; // 3' to 7'
3236
- return {
3237
- feet:Math.floor(totalInches / 12),
3238
- inches:Math.round(totalInches % 12),
1860
+ return {
1861
+ feet: Math.floor(totalInches / 12),
1862
+ inches: Math.round(totalInches % 12),
3239
1863
  totalInches,
3240
1864
 
3241
- centimeters:Math.round(totalInches*2.54)
1865
+ centimeters: Math.round(totalInches * 2.54)
3242
1866
  };
3243
1867
  }
3244
1868
  function inchesToMiiHeight(totalInches) {
3245
1869
  return ((totalInches - 36) * 127) / 48;
3246
1870
  }
3247
1871
  function centimetersToMiiHeight(totalCentimeters) {
3248
- return ((Math.round(totalCentimeters/2.54) - 36) * 127) / 48;
1872
+ return ((Math.round(totalCentimeters / 2.54) - 36) * 127) / 48;
3249
1873
  }
3250
1874
 
3251
1875
  // ---- Tunable anchors (BMI breakpoints) ----
@@ -3275,8 +1899,8 @@ function miiWeightToRealWeight(heightInches, miiWeight) {
3275
1899
  const H = miiHeightToMeasurements(heightInches).totalInches;
3276
1900
  const BMI = bmiFromWeightSlider(miiWeight);
3277
1901
  return {
3278
- pounds:BMI * (H * H) / 703,
3279
- kilograms:Math.round((BMI * (H * H) / 703)*0.4535924)
1902
+ pounds: BMI * (H * H) / 703,
1903
+ kilograms: Math.round((BMI * (H * H) / 703) * 0.4535924)
3280
1904
  };
3281
1905
  }
3282
1906
  function imperialHeightWeightToMiiWeight(heightInches, weightLbs) {
@@ -3293,8 +1917,8 @@ function imperialHeightWeightToMiiWeight(heightInches, weightLbs) {
3293
1917
  }
3294
1918
  }
3295
1919
  function metricHeightWeightToMiiWeight(heightCentimeters, weightKilograms) {
3296
- const heightInches=Math.round(heightCentimeters/2.54);
3297
- const weightLbs=Math.round(weightKilograms/0.4535924);
1920
+ const heightInches = Math.round(heightCentimeters / 2.54);
1921
+ const weightLbs = Math.round(weightKilograms / 0.4535924);
3298
1922
  if (!heightInches || heightInches < 0) throw new Error("heightCentimeters must be >= 0");
3299
1923
 
3300
1924
  const H = miiHeightToMeasurements(heightInches).totalInches;
@@ -3331,7 +1955,7 @@ module.exports = {
3331
1955
  writeWiiBin,
3332
1956
  write3DSQR,
3333
1957
 
3334
- //make3DSChild, //WIP
1958
+ makeChild,
3335
1959
 
3336
1960
  //Instructions
3337
1961
  generateInstructions,
@@ -3341,7 +1965,6 @@ module.exports = {
3341
1965
  inchesToMiiHeight,
3342
1966
  centimetersToMiiHeight,
3343
1967
 
3344
- //Highly Experimental
3345
1968
  miiWeightToRealWeight,
3346
1969
  imperialHeightWeightToMiiWeight,
3347
1970
  metricHeightWeightToMiiWeight,