miijs 2.1.0 → 2.1.1

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/README.md CHANGED
@@ -6,6 +6,7 @@ MiiJS is a JS library for working with Mii characters in an accessible way. Read
6
6
  `npm install miijs` | `npm i miijs`
7
7
 
8
8
  <hr>
9
+
9
10
  ## Table of Contents
10
11
  - [Functions](#functions)
11
12
  - [Special Miis](#special-miis)
@@ -91,4 +92,4 @@ You can find FFLResHigh using a Wii U with an FTP program installed at `sys/titl
91
92
 
92
93
  # Credits
93
94
  - **[kazuki-4ys' MiiInfoEditorCTR](https://github.com/kazuki-4ys/kazuki-4ys.github.io/tree/master/web_apps/MiiInfoEditorCTR)** - I repurposed how to decrypt and reencrypt the QR codes from here, including repurposing the asmCrypto.js file in its entirety with very small modifications (it has since been stripped down to only include the functions this library uses). I believe I also modified the code for rendering the Mii using Nintendo's Mii Studio from here as well, though I do not remember for certain.
94
- - **[ariankordi's FFL.js](https://github.com/ariankordi/FFL.js/)** - Rendering Miis locally would not be possible without this library. Instructions for finding FFLResHigh are also learned from [ariankordi's FFL-Testing repository](https://github.com/ariankordi/FFL-Testing).
95
+ - **[ariankordi's FFL.js](https://github.com/ariankordi/FFL.js/)** - Rendering Miis locally would not be possible without this library. Instructions for finding FFLResHigh are also learned from [ariankordi's FFL-Testing repository](https://github.com/ariankordi/FFL-Testing).
@@ -0,0 +1,188 @@
1
+ {
2
+ "male":{
3
+ "general": {
4
+ "type":3,
5
+ "birthday": 17,
6
+ "birthMonth": 4,
7
+ "height": 0,
8
+ "weight": 0,
9
+ "gender": 1,
10
+ "favoriteColor": 7
11
+ },
12
+ "meta":{
13
+ "name": "",
14
+ "creatorName": "",
15
+ "console":"3ds",
16
+ "miiId":"148",
17
+ "systemId":"148"
18
+ },
19
+ "perms": {
20
+ "sharing": false,
21
+ "copying": true,
22
+ "fromCheckMiiOut": false,
23
+ "mingle": true
24
+ },
25
+ "hair": {
26
+ "page":0,
27
+ "type":7,
28
+ "color": 7,
29
+ "flipped": false
30
+ },
31
+ "face": {
32
+ "type": 5,
33
+ "color": 0,
34
+ "feature": 0,
35
+ "makeup": 0
36
+ },
37
+ "eyes": {
38
+ "page":0,
39
+ "type": 9,
40
+ "col": 4,
41
+ "size": 1,
42
+ "squash": 3,
43
+ "rotation": 4,
44
+ "distanceApart": 3,
45
+ "yPosition": 11
46
+ },
47
+ "eyebrows": {
48
+ "page":0,
49
+ "type":5,
50
+ "color":7,
51
+ "size": 2,
52
+ "squash": 4,
53
+ "rotation": 4,
54
+ "distanceApart": 4,
55
+ "yPosition": 6
56
+ },
57
+ "nose": {
58
+ "page":1,
59
+ "type":0,
60
+ "size": 0,
61
+ "yPosition": 5
62
+ },
63
+ "mouth": {
64
+ "page":1,
65
+ "type":6,
66
+ "color": 0,
67
+ "size": 2,
68
+ "squash": 3,
69
+ "yPosition": 10
70
+ },
71
+ "beard": {
72
+ "mustache":{
73
+ "type": 0,
74
+ "size": 4,
75
+ "yPosition": 10
76
+ },
77
+ "col": 0,
78
+ "type": 0
79
+ },
80
+ "glasses": {
81
+ "type": 0,
82
+ "color":0,
83
+ "size": 4,
84
+ "yPosition": 10
85
+ },
86
+ "mole": {
87
+ "on": false,
88
+ "size": 4,
89
+ "xPosition": 2,
90
+ "yPosition": 20
91
+ },
92
+ "name": "",
93
+ "creatorName": ""
94
+ },
95
+ "female":{
96
+ "general": {
97
+ "type":3,
98
+ "birthday": 17,
99
+ "birthMonth": 4,
100
+ "height": 0,
101
+ "weight": 0,
102
+ "gender": 1,
103
+ "favoriteColor": 7
104
+ },
105
+ "meta":{
106
+ "name": "",
107
+ "creatorName": "",
108
+ "console":"3ds",
109
+ "miiId":"148",
110
+ "systemId":"148"
111
+ },
112
+ "perms": {
113
+ "sharing": false,
114
+ "copying": true,
115
+ "fromCheckMiiOut": false,
116
+ "mingle": true
117
+ },
118
+ "hair": {
119
+ "page":0,
120
+ "type":7,
121
+ "color": 7,
122
+ "flipped": false
123
+ },
124
+ "face": {
125
+ "type": 5,
126
+ "color": 0,
127
+ "feature": 0,
128
+ "makeup": 0
129
+ },
130
+ "eyes": {
131
+ "page":0,
132
+ "type": 9,
133
+ "col": 4,
134
+ "size": 1,
135
+ "squash": 3,
136
+ "rotation": 4,
137
+ "distanceApart": 3,
138
+ "yPosition": 11
139
+ },
140
+ "eyebrows": {
141
+ "page":0,
142
+ "type":5,
143
+ "color":7,
144
+ "size": 2,
145
+ "squash": 4,
146
+ "rotation": 4,
147
+ "distanceApart": 4,
148
+ "yPosition": 6
149
+ },
150
+ "nose": {
151
+ "page":1,
152
+ "type":0,
153
+ "size": 0,
154
+ "yPosition": 5
155
+ },
156
+ "mouth": {
157
+ "page":1,
158
+ "type":6,
159
+ "color": 0,
160
+ "size": 2,
161
+ "squash": 3,
162
+ "yPosition": 10
163
+ },
164
+ "beard": {
165
+ "mustache":{
166
+ "type": 0,
167
+ "size": 4,
168
+ "yPosition": 10
169
+ },
170
+ "col": 0,
171
+ "type": 0
172
+ },
173
+ "glasses": {
174
+ "type": 0,
175
+ "color":0,
176
+ "size": 4,
177
+ "yPosition": 10
178
+ },
179
+ "mole": {
180
+ "on": false,
181
+ "size": 4,
182
+ "xPosition": 2,
183
+ "yPosition": 20
184
+ },
185
+ "name": "",
186
+ "creatorName": ""
187
+ }
188
+ }
package/index.js CHANGED
@@ -12,11 +12,12 @@ const asmCrypto=require("./asmCrypto.js");
12
12
  const path=require("path");
13
13
  const createGL = require('gl');
14
14
 
15
+ const req=require("require-esm-in-cjs");
15
16
  const {
16
17
  createCharModel, initCharModelTextures,
17
18
  initializeFFL, exitFFL, parseHexOrB64ToUint8Array,
18
19
  setIsWebGL1State, getCameraForViewType, ViewType
19
- } = require("ffl.js/ffl.js");
20
+ } = req("ffl.js/ffl.js");
20
21
  const ModuleFFL = require("ffl.js/examples/ffl-emscripten-single-file.js");
21
22
  const FFLShaderMaterial = require("ffl.js/FFLShaderMaterial.js");
22
23
 
@@ -734,7 +735,6 @@ var convTables={
734
735
  "10",9,11
735
736
  ]
736
737
  };
737
-
738
738
  const kidNames={
739
739
  "Male":[
740
740
  "Aaron",
@@ -1223,9 +1223,7 @@ const defaultMii={
1223
1223
  "meta":{
1224
1224
  "name": "Madison",
1225
1225
  "creatorName": "",
1226
- "console":"3ds",
1227
- "miiId":"148",
1228
- "systemId":"148"
1226
+ "console":"3ds"
1229
1227
  },
1230
1228
  "perms": {
1231
1229
  "sharing": false,
@@ -1300,7 +1298,7 @@ const defaultMii={
1300
1298
  "xPosition": 2,
1301
1299
  "yPosition": 20
1302
1300
  },
1303
- "name": "Madison",
1301
+ "name": "",
1304
1302
  "creatorName": ""
1305
1303
  },
1306
1304
  "female":{
@@ -1316,9 +1314,7 @@ const defaultMii={
1316
1314
  "meta":{
1317
1315
  "name": "Madison",
1318
1316
  "creatorName": "",
1319
- "console":"3ds",
1320
- "miiId":"148",
1321
- "systemId":"148"
1317
+ "console":"3ds"
1322
1318
  },
1323
1319
  "perms": {
1324
1320
  "sharing": false,
@@ -1393,7 +1389,7 @@ const defaultMii={
1393
1389
  "xPosition": 2,
1394
1390
  "yPosition": 20
1395
1391
  },
1396
- "name": "Madison",
1392
+ "name": "",
1397
1393
  "creatorName": ""
1398
1394
  }
1399
1395
  };
@@ -1900,171 +1896,54 @@ function convertMii(jsonIn,typeTo){
1900
1896
  return jsonIn;
1901
1897
  }
1902
1898
  let mii=jsonIn;
1903
- var miiTo={};
1899
+ var miiTo=structuredClone(mii);
1904
1900
  if(["wii u","3ds"].includes(typeFrom)){
1905
- miiTo={
1906
- info:{},
1907
- face:{},
1908
- nose:{},
1909
- mouth:{},
1910
- mole:{},
1911
- hair:{},
1912
- eyebrows:{},
1913
- eyes:{},
1914
- glasses:{},
1915
- facialHair:{}
1916
- };
1917
- miiTo.creatorName=mii.creatorName;
1918
- miiTo.info.creatorName=miiTo.creatorName;
1919
- miiTo.name=mii.name;
1920
- miiTo.info.name=miiTo.name;
1921
- miiTo.info.gender=mii.info.gender;
1922
- miiTo.info.systemId="ffffffff";
1923
- let miiId;
1924
- switch(mii.info.type){
1925
- case "Special":
1926
- miiId="01000110";
1927
- break;
1928
- case "Foreign":
1929
- miiId="11000110";
1930
- break;
1931
- default:
1932
- miiId="10001001";
1933
- break;
1934
- }
1935
- for(var i=0;i<3;i++){
1936
- miiId+=Math.floor(Math.random()*255).toString(2).padStart(8,"0");
1937
- }
1938
- miiTo.info.miiId+=miiId;
1939
- miiTo.info.mingle=mii.perms.copying;
1940
- miiTo.info.birthMonth=mii.info.birthMonth;
1941
- miiTo.info.birthday=mii.info.birthday;
1942
- miiTo.info.favColor=mii.info.favColor;
1943
- miiTo.info.favorited=false;
1944
- miiTo.info.height=mii.info.height;
1945
- miiTo.info.weight=mii.info.weight;
1946
- miiTo.info.downloadedFromCheckMiiOut=false;
1947
- miiTo.face.shape=convTables.face3DSToWii[mii.face.shape];
1948
- miiTo.face.col=mii.face.col;
1901
+ miiTo.perms.mingle=mii.perms.sharing;
1902
+ miiTo.perms.fromCheckMiiOut=false;
1903
+ miiTo.face.type=convTables.face3DSToWii[mii.face.type];
1949
1904
  //We prioritize Facial Features here because the Wii supports more of those than they do Makeup types, and is more likely to apply. The 3DS has two separate fields, so you can have makeup and wrinkles applied at the same time. The Wii only has one that covers both.
1950
- if(typeof(convTables.features3DSToWii[faceFeatures3DS.indexOf(mii.face.feature)])==='string'){
1951
- miiTo.face.feature=wiiFaceFeatures[convTables.makeup3DSToWii[makeups3DS.indexOf(mii.face.makeup)]];
1905
+ if(typeof(convTables.features3DSToWii[mii.face.feature])==='string'){
1906
+ miiTo.face.feature=convTables.makeup3DSToWii[mii.face.makeup];
1952
1907
  }
1953
1908
  else{
1954
- miiTo.face.feature=wiiFaceFeatures[convTables.features3DSToWii[features3DS.indexOf(mii.face.feature)]];
1909
+ miiTo.face.feature=convTables.features3DSToWii[mii.face.feature];
1955
1910
  }
1956
- miiTo.nose.type=convTables.nose3DSToWii[mii.nose.type[0]][mii.nose.type[1]];
1957
- miiTo.nose.size=mii.nose.size;
1958
- miiTo.nose.yPos=mii.nose.yPos;
1959
- miiTo.mouth.type=convTables.mouth3DSToWii[mii.mouth.type[0]][mii.mouth.type[1]];
1960
- miiTo.mouth.col=wiiMouthColors[mouthCols3DS.indexOf(mii.mouth.col)>2?0:mouthCols3DS.indexOf(mii.mouth.col)];
1961
- miiTo.mouth.size=mii.mouth.size;
1962
- miiTo.mouth.yPos=mii.mouth.yPos;
1963
- miiTo.mole=mii.mole;
1964
- miiTo.hair.col=mii.hair.col;
1965
- miiTo.hair.flipped=mii.hair.flipped;
1966
- miiTo.hair.type=convTables.hair3DSToWii[mii.hair.style[0]][mii.hair.style[1]];
1967
- miiTo.eyebrows.type=convTables.eyebrows3DSToWii[mii.eyebrows.style[0]][mii.eyebrows.style[1]];
1968
- miiTo.eyebrows.col=mii.eyebrows.col;
1969
- miiTo.eyebrows.rotation=mii.eyebrows.rot;
1970
- miiTo.eyebrows.size=mii.eyebrows.size;
1971
- miiTo.eyebrows.yPos=mii.eyebrows.yPos;
1972
- miiTo.eyebrows.distApart=mii.eyebrows.distApart;
1973
- miiTo.eyes.type=convTables.eyes3DSToWii[mii.eyes.type[0]][mii.eyes.type[1]];
1974
- miiTo.eyes.rotation=mii.eyes.rot;
1975
- miiTo.eyes.yPos=mii.eyes.yPos;
1976
- miiTo.eyes.col=mii.eyes.col;
1977
- miiTo.eyes.size=mii.eyes.size;
1978
- miiTo.eyes.distApart=mii.eyes.distApart;
1979
- miiTo.glasses=mii.glasses;
1980
- miiTo.glasses.col=wiiGlassesCols[glassesCols3DS.indexOf(mii.glasses.col)];
1981
- miiTo.facialHair=mii.facialHair;
1982
- if(miiTo.facialHair.mustacheType===4){
1983
- miiTo.facialHair.mustacheType=2;
1911
+ miiTo.nose.type=convTables.nose3DSToWii[mii.nose.page][mii.nose.type];
1912
+ miiTo.mouth.type=convTables.mouth3DSToWii[mii.mouth.page][mii.mouth.type];
1913
+ miiTo.mouth.color=mii.mouth.col>2?0:mii.mouth.col;
1914
+ miiTo.hair.type=convTables.hair3DSToWii[mii.hair.page][mii.hair.type];
1915
+ miiTo.eyebrows.type=convTables.eyebrows3DSToWii[mii.eyebrows.page][mii.eyebrows.type];
1916
+ miiTo.eyes.type=convTables.eyes3DSToWii[mii.eyes.page][mii.eyes.type];
1917
+ miiTo.glasses.col=mii.glasses.col;
1918
+ if(miiTo.beard.mustache.type===4){
1919
+ miiTo.beard.mustache.type=2;
1984
1920
  }
1985
- else if(miiTo.facialHair.mustacheType===5){
1986
- miiTo.facialHair.mustacheType=0;
1987
- miiTo.facialHair.beardType=1;
1921
+ else if(miiTo.beard.mustache.type===5){
1922
+ miiTo.beard.mustache.type=0;
1923
+ miiTo.beard.type=1;
1988
1924
  }
1989
- if(mii.facialHair.beardType>3){
1990
- mii.facialHair.beardType=3;
1925
+ if(mii.beard.type>3){
1926
+ mii.beard.type=3;
1991
1927
  }
1992
1928
  miiTo.console="wii";
1993
1929
  }
1994
1930
  else if(typeFrom==="wii"){
1995
- miiTo={
1996
- info:{},
1997
- perms:{},
1998
- hair:{},
1999
- face:{},
2000
- eyes:{},
2001
- eyebrows:{},
2002
- nose:{},
2003
- mouth:{},
2004
- facialHair:{},
2005
- glasses:{},
2006
- mole:{}
2007
- };
2008
- miiTo.info.birthday=mii.info.birthday;
2009
- miiTo.info.birthMonth=mii.info.birthMonth;
2010
- miiTo.name=mii.name;
2011
- miiTo.info.name=miiTo.name;
2012
- miiTo.creatorName=mii.creatorName;
2013
- miiTo.info.creatorName=mii.creatorName;
2014
- miiTo.info.height=mii.info.height;
2015
- miiTo.info.weight=mii.info.weight;
2016
- miiTo.info.favColor=mii.info.favColor;
2017
- miiTo.info.gender=mii.info.gender;
2018
1931
  miiTo.perms.sharing=mii.info.mingle;
2019
1932
  miiTo.perms.copying=mii.info.mingle;
2020
- miiTo.hair.col=hairCols[hairCols.indexOf(mii.hair.col)];
2021
- miiTo.hair.flipped=mii.hair.flipped;
2022
- miiTo.hair.style=convTables.hairWiiTo3DS[+mii.hair.type[0]-1][0+(3*(+mii.hair.type[2]-1))+(+mii.hair.type[1]-1)];
1933
+ miiTo.hair.style=convTables.hairWiiTo3DS[mii.hair.page][mii.hair.type];
2023
1934
  miiTo.face.shape=convTables.faceWiiTo3DS[mii.face.shape];
2024
- miiTo.face.col=skinCols[skinCols.indexOf(mii.face.col)];
2025
- miiTo.face.makeup="None";
2026
- miiTo.face.feature="None";
2027
- if(typeof(convTables.featureWiiTo3DS[wiiFaceFeatures.indexOf(mii.face.feature)])==='string'){
2028
- miiTo.face.makeup=makeups3DS[+convTables.featureWiiTo3DS[wiiFaceFeatures.indexOf(mii.face.feature)]];
1935
+ miiTo.face.makeup=0;
1936
+ miiTo.face.feature=0;
1937
+ if(typeof(convTables.featureWiiTo3DS[mii.face.feature])==='string'){
1938
+ miiTo.face.makeup=makeups3DS[+convTables.featureWiiTo3DS[mii.face.feature]];
2029
1939
  }
2030
1940
  else{
2031
- miiTo.face.feature=faceFeatures3DS[convTables.featureWiiTo3DS[wiiFaceFeatures.indexOf(mii.face.feature)]];
1941
+ miiTo.face.feature=faceFeatures3DS[convTables.featureWiiTo3DS[mii.face.feature]];
2032
1942
  }
2033
- miiTo.eyes.col=eyeCols[eyeCols.indexOf(mii.eyes.col)];
2034
- miiTo.eyes.type=[+mii.eyes.type[0]-1,(+mii.eyes.type[1]-1)+(3*(+mii.eyes.type[2]-1))];
2035
- miiTo.eyes.size=mii.eyes.size;
2036
1943
  miiTo.eyes.squash=3;
2037
- miiTo.eyes.rot=mii.eyes.rotation;
2038
- miiTo.eyes.distApart=mii.eyes.distApart;
2039
- miiTo.eyes.yPos=mii.eyes.yPos;
2040
- miiTo.eyebrows.style=[+mii.eyebrows.type[0]-1,(+mii.eyebrows.type[1]-1)+(3*(+mii.eyebrows.type[2]-1))];
2041
- miiTo.eyebrows.col=hairCols[hairCols.indexOf(mii.eyebrows.col)];
2042
- miiTo.eyebrows.size=mii.eyebrows.size;
2043
1944
  miiTo.eyebrows.squash=3;
2044
- miiTo.eyebrows.rot=mii.eyebrows.rotation;
2045
- miiTo.eyebrows.distApart=mii.eyebrows.distApart;
2046
- miiTo.eyebrows.yPos=mii.eyebrows.yPos;
2047
- miiTo.nose.type=[0,mii.nose.type];
2048
- miiTo.nose.size=mii.nose.size;
2049
- miiTo.nose.yPos=mii.nose.yPos;
2050
- miiTo.mouth.type=[+mii.mouth.type[0]-1,(+mii.mouth.type[1]-1)+(3*(+mii.mouth.type[2]-1))];
2051
- miiTo.mouth.col=mouthCols3DS[wiiMouthColors.indexOf(mii.mouth.col)];
2052
- miiTo.mouth.size=mii.mouth.size;
1945
+ miiTo.mouth.col=mouthCols3DS[mii.mouth.col];//qk
2053
1946
  miiTo.mouth.squash=3;
2054
- miiTo.mouth.yPos=mii.mouth.yPos;
2055
- miiTo.facialHair.mustacheType=mii.facialHair.mustacheType;
2056
- miiTo.facialHair.beardType=mii.facialHair.beardType;
2057
- miiTo.facialHair.col=hairCols[hairCols.indexOf(mii.facialHair.col)];
2058
- miiTo.facialHair.mustacheSize=mii.facialHair.mustacheSize;
2059
- miiTo.facialHair.mustacheYPos=mii.facialHair.mustacheYPos;
2060
- miiTo.glasses.type=mii.glasses.type;
2061
- miiTo.glasses.col=glassesCols3DS[["Grey","Brown","Red","Blue","Yellow","White"].indexOf(mii.glasses.col)];
2062
- miiTo.glasses.size=mii.glasses.size;
2063
- miiTo.glasses.yPos=mii.glasses.yPos;
2064
- miiTo.mole.on=mii.mole.on;
2065
- miiTo.mole.size=mii.mole.size;
2066
- miiTo.mole.xPos=mii.mole.xPos;
2067
- miiTo.mole.yPos=mii.mole.yPos;
2068
1947
  miiTo.console="3ds";
2069
1948
  }
2070
1949
  return miiTo;
@@ -2075,38 +1954,38 @@ function convertMiiToStudio(jsonIn) {
2075
1954
  }
2076
1955
  var mii = jsonIn;
2077
1956
  var studioMii = new Uint8Array([0x08, 0x00, 0x40, 0x03, 0x08, 0x04, 0x04, 0x02, 0x02, 0x0c, 0x03, 0x01, 0x06, 0x04, 0x06, 0x02, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0x00, 0x0a, 0x01, 0x00, 0x21, 0x40, 0x04, 0x00, 0x02, 0x14, 0x03, 0x13, 0x04, 0x17, 0x0d, 0x04, 0x00, 0x0a, 0x04, 0x01, 0x09]);
2078
- studioMii[0x16] = mii.info.gender === "Male" ? 0 : 1;
2079
- studioMii[0x15] = lookupTables.favCols.indexOf(mii.info.favColor);
1957
+ studioMii[0x16] = mii.general.gender;
1958
+ studioMii[0x15] = mii.info.favoriteColor;
2080
1959
  studioMii[0x1E] = mii.info.height;
2081
1960
  studioMii[2] = mii.info.weight;
2082
- studioMii[0x13] = lookupTables.faces.values[mii.face.shape];
2083
- studioMii[0x11] = lookupTables.skinCols.indexOf(mii.face.col);
2084
- studioMii[0x14] = lookupTables.faceFeatures3DS.indexOf(mii.face.feature);
2085
- studioMii[0x12] = lookupTables.makeups3DS.indexOf(mii.face.makeup);
2086
- studioMii[0x1D] = lookupTables.hairs.values[mii.hair.style[0]][mii.hair.style[1]];
2087
- studioMii[0x1B] = lookupTables.hairCols.indexOf(mii.hair.col);
1961
+ studioMii[0x13] = lookupTables.faces.values[mii.face.type];
1962
+ studioMii[0x11] = mii.face.color;
1963
+ studioMii[0x14] = mii.face.feature;
1964
+ studioMii[0x12] = mii.face.makeup;
1965
+ studioMii[0x1D] = lookupTables.hairs.values[mii.hair.page][mii.hair.type];
1966
+ studioMii[0x1B] = mii.hair.color;
2088
1967
  if (!studioMii[0x1B]) studioMii[0x1B] = 8;
2089
1968
  studioMii[0x1C] = mii.hair.flipped ? 1 : 0;
2090
- studioMii[7] = lookupTables.eyes.values[mii.eyes.type[0]][mii.eyes.type[1]];
2091
- studioMii[4] = lookupTables.eyeCols.indexOf(mii.eyes.col) + 8;
1969
+ studioMii[7] = lookupTables.eyes.values[mii.eyes.page][mii.eyes.type];
1970
+ studioMii[4] = mii.eyes.color + 8;
2092
1971
  studioMii[6] = mii.eyes.size;
2093
1972
  studioMii[3] = mii.eyes.squash;
2094
- studioMii[5] = mii.eyes.rot;
2095
- studioMii[8] = mii.eyes.distApart;
2096
- studioMii[9] = mii.eyes.yPos;
2097
- studioMii[0xE] = lookupTables.eyebrows.values[mii.eyebrows.style[0]][mii.eyebrows.style[1]];
2098
- studioMii[0xB] = lookupTables.hairCols.indexOf(mii.eyebrows.col);
1973
+ studioMii[5] = mii.eyes.rotation;
1974
+ studioMii[8] = mii.eyes.distanceApart;
1975
+ studioMii[9] = mii.eyes.yPosition;
1976
+ studioMii[0xE] = lookupTables.eyebrows.values[mii.eyebrows.page][mii.eyebrows.type];
1977
+ studioMii[0xB] = mii.eyebrows.color;
2099
1978
  if (!studioMii[0xB]) studioMii[0xB] = 8;
2100
1979
  studioMii[0xD] = mii.eyebrows.size;
2101
1980
  studioMii[0xA] = mii.eyebrows.squash;
2102
- studioMii[0xC] = mii.eyebrows.rot;
2103
- studioMii[0xF] = mii.eyebrows.distApart;
2104
- studioMii[0x10] = mii.eyebrows.yPos + 3;
2105
- studioMii[0x2C] = lookupTables.noses.values[mii.nose.type[0]][mii.nose.type[1]];
1981
+ studioMii[0xC] = mii.eyebrows.rotation;
1982
+ studioMii[0xF] = mii.eyebrows.distanceApart;
1983
+ studioMii[0x10] = mii.eyebrows.yPosition + 3;
1984
+ studioMii[0x2C] = lookupTables.noses.values[mii.nose.page][mii.nose.type];
2106
1985
  studioMii[0x2B] = mii.nose.size;
2107
- studioMii[0x2D] = mii.nose.yPos;
2108
- studioMii[0x26] = lookupTables.mouths.values[mii.mouth.type[0]][mii.mouth.type[1]];
2109
- studioMii[0x24] = lookupTables.hairCols.indexOf(mii.mouth.col);
1986
+ studioMii[0x2D] = mii.nose.yPosition;
1987
+ studioMii[0x26] = lookupTables.mouths.values[mii.mouth.page][mii.mouth.type];
1988
+ studioMii[0x24] = mii.mouth.col;
2110
1989
  if (studioMii[0x24] < 4) {
2111
1990
  studioMii[0x24] += 19;
2112
1991
  } else {
@@ -2131,11 +2010,11 @@ function convertMiiToStudio(jsonIn) {
2131
2010
  studioMii[0x17] = 0;
2132
2011
  }
2133
2012
  studioMii[0x18] = mii.glasses.size;
2134
- studioMii[0x1A] = mii.glasses.yPos;
2013
+ studioMii[0x1A] = mii.glasses.yPosition;
2135
2014
  studioMii[0x20] = mii.mole.on ? 1 : 0;
2136
2015
  studioMii[0x1F] = mii.mole.size;
2137
- studioMii[0x21] = mii.mole.xPos;
2138
- studioMii[0x22] = mii.mole.yPos;
2016
+ studioMii[0x21] = mii.mole.xPosition;
2017
+ studioMii[0x22] = mii.mole.yPosition;
2139
2018
  return encodeStudio(studioMii);
2140
2019
  }
2141
2020
  async function readWiiBin(binOrPath) {
@@ -2185,7 +2064,7 @@ async function renderMiiWithStudio(jsonIn){
2185
2064
  if(!["3ds","wii u"].includes(jsonIn.console?.toLowerCase())){
2186
2065
  jsonIn=convertMii(jsonIn);
2187
2066
  }
2188
- var studioMii=convert3DSMiiToStudio(jsonIn);
2067
+ var studioMii=convertMiiToStudio(jsonIn);
2189
2068
  return await downloadImage('https://studio.mii.nintendo.com/miis/image.png?data=' + studioMii + "&width=270&type=face");
2190
2069
  }
2191
2070
  async function createFFLMiiIcon(data, width, height, fflRes) {
@@ -2294,7 +2173,7 @@ async function renderMii(jsonIn, fflRes=getFFLRes()){
2294
2173
  if(!["3ds","wii u"].includes(jsonIn.console?.toLowerCase())){
2295
2174
  jsonIn=convertMii(jsonIn);
2296
2175
  }
2297
- const studioMii = convert3DSMiiToStudio(jsonIn);
2176
+ const studioMii = convertMiiToStudio(jsonIn);
2298
2177
  const width = height = 600;
2299
2178
 
2300
2179
  return createFFLMiiIcon(studioMii, width, height, fflRes);
@@ -2520,52 +2399,53 @@ function make3DSChild(dad,mom,options={}){
2520
2399
  function generateInstructions(mii,full){
2521
2400
  let type=mii.console?.toLowerCase();
2522
2401
  if(type.toLowerCase()==="wii"){
2402
+ var typeCheat=[1,2,3,1,2,3,1,2,3,1,2,3];
2523
2403
  var instrs={
2524
- "base":`Select "${mii.info.gender}", and then "Start from Scratch".`,
2525
- "col":`On the info page (first tab), set the Favorite Color to ${mii.info.favColor} (${favCols.indexOf(mii.info.favColor)<=5?favCols.indexOf(mii.info.favColor)+1:favCols.indexOf(mii.info.favColor)-5} from the left, ${favCols.indexOf(mii.info.favColor)>5?"bottom":"top"} row).`,
2526
- "heightWeight":`On the build page (second tab), set the height to ${Math.round((100/128)*mii.info.height)}%, and the weight to ${Math.round((100/128)*mii.info.weight)}%.`,
2527
- "faceShape":`On the face page (third tab), set the shape to the one ${Math.floor(mii.face.shape/2)+1} from the top, in the ${mii.face.shape%2===0?"left":"right"} column.`,
2528
- "skinCol":`On the face page (third tab), set the color to the one ${skinCols.indexOf(mii.face.col)+skinCols.indexOf(mii.face.col)>2?-2:1} from the left, on the ${skinCols.indexOf(mii.face.col)>2?`bottom`:`top`} row.`,
2529
- "makeup":`On the face page's makeup tab, set the makeup to \"${mii.face.feature}\" (the one ${Math.ceil((wiiFaceFeatures.indexOf(mii.face.feature)+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][wiiFaceFeatures.indexOf(mii.face.feature)]} from the left).`,
2530
- "hairStyle":`On the hair page (fourth tab), set the hair style to the one ${mii.hair.type[1]} from the left, ${mii.hair.type[2]} from the top, on page ${mii.hair.type[0]}.`,
2404
+ "base":`Select "${mii.general.gender}", and then "Start from Scratch".`,
2405
+ "col":`On the info page (first tab), set the Favorite Color to ${lookupTables.favCols[mii.general.favoriteColor]} (${mii.general.favoriteColor<=5?mii.general.favoriteColor+1:mii.general.favoriteColor-5} from the left, ${mii.general.favoriteColor>5?"bottom":"top"} row).`,
2406
+ "heightWeight":`On the build page (second tab), set the height to ${Math.round((100/128)*mii.general.height)}%, and the weight to ${Math.round((100/128)*mii.general.weight)}%.`,
2407
+ "faceShape":`On the face page (third tab), set the shape to the one ${Math.floor(mii.face.type/2)+1} from the top, in the ${mii.face.type%2===0?"left":"right"} column.`,
2408
+ "skinCol":`On the face page (third tab), set the color to the one ${mii.face.color+mii.face.color>2?-2:1} from the left, on the ${mii.face.color>2?`bottom`:`top`} row.`,
2409
+ "makeup":`On the face page's makeup tab, set the makeup to the one ${Math.ceil((mii.face.feature+1)/3)} from the top, and ${typeCheat[mii.face.feature]} from the left.`,
2410
+ "hairStyle":`On the hair page (fourth tab), set the hair style to the one ${typeCheat[mii.hair.type]} from the left, ${Math.ceil((mii.hair.type+1)/3)} from the top, on page ${mii.hair.page}.`,
2531
2411
  "hairFlipped":`${mii.hair.flipped?`On the hair page (fourth tab), press the button to flip the hair.`:``}`,
2532
- "hairColor":`On the hair page (fourth tab), set the hair color to the one ${hairCols.indexOf(mii.hair.col)+(hairCols.indexOf(mii.hair.col)>3?-3:1)} from the left, on the ${hairCols.indexOf(mii.hair.col)>3?`bottom`:`top`} row.`,
2533
- "eyebrowStyle":`On the eyebrow page (fifth tab), set the eyebrow style to the one ${mii.eyebrows.type[1]} from the left, ${mii.eyebrows.type[2]} from the top, on page ${mii.eyebrows.type[0]}.`,
2534
- "eyebrowColor":`On the eyebrow page (fifth tab), set the eyebrow color to the one ${hairCols.indexOf(mii.eyebrows.col)+(hairCols.indexOf(mii.eyebrows.col)>3?-3:1)} from the left, on the ${hairCols.indexOf(mii.eyebrows.col)>3?`bottom`:`top`} row.`,
2535
- "eyebrowY":`${mii.eyebrows.yPos!==7?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.yPos<7?`press the up button ${7-mii.eyebrows.yPos} times.`:mii.eyebrows.yPos>7?`press the down button ${mii.eyebrows.yPos-7} times.`:``}`,
2412
+ "hairColor":`On the hair page (fourth tab), set the hair color to the one ${mii.hair.col+(mii.hair.col>3?-3:1)} from the left, on the ${mii.hair.col>3?`bottom`:`top`} row.`,
2413
+ "eyebrowStyle":`On the eyebrow page (fifth tab), set the eyebrow style to the one ${typeCheat[mii.eyebrows.type]} from the left, ${Math.ceil((mii.eyebrows.type+1)/3)} from the top, on page ${mii.eyebrows.page}.`,
2414
+ "eyebrowColor":`On the eyebrow page (fifth tab), set the eyebrow color to the one ${mii.eyebrows.color+(mii.eyebrows.color>3?-3:1)} from the left, on the ${mii.eyebrows.color>3?`bottom`:`top`} row.`,
2415
+ "eyebrowY":`${mii.eyebrows.yPos!==7?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.yPosition<7?`press the up button ${7-mii.eyebrows.yPosition} times.`:mii.eyebrows.yPosition>7?`press the down button ${mii.eyebrows.yPosition-7} times.`:``}`,
2536
2416
  "eyebrowSize":`${mii.eyebrows.size!==4?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.size<4?`press the shrink button ${4-mii.eyebrows.size} times.`:mii.eyebrows.size>4?`press the enlarge button ${mii.eyebrows.size-4} times.`:``}`,
2537
2417
  "eyebrowRot":`${mii.eyebrows.rotation!==6?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.rotation<6?`press the rotate clockwise button ${6-mii.eyebrows.rotation} times.`:mii.eyebrows.rotation>6?`press the rotate counter-clockwise button ${mii.eyebrows.rotation-6} times.`:``}`,
2538
- "eyebrowDist":`${mii.eyebrows.distApart!==2?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.distApart<2?`press the closer-together button ${2-mii.eyebrows.distApart} times.`:mii.eyebrows.distApart>2?`press the further-apart button ${mii.eyebrows.distApart-2} times.`:``}`,
2539
- "eyeType":`On the eye page (sixth tab), set the eye type to the one ${mii.eyes.type[1]} from the left, ${mii.eyes.type[2]} from the top, on page ${mii.eyes.type[0]}.`,
2540
- "eyeColor":`On the eye page (sixth tab), set the color to the one ${eyeCols.indexOf(mii.eyes.col)+(eyeCols.indexOf(mii.eyes.col)>2?-2:1)} from the left, on the ${eyeCols.indexOf(mii.eyes.col)>2?`bottom`:`top`} row.`,
2541
- "eyeY":`${mii.eyes.yPos!==12?`On the eye page (sixth tab), `:``}${mii.eyes.yPos<12?`press the up button ${12-mii.eyes.yPos} times.`:mii.eyes.yPos>12?`press the down button ${mii.eyes.yPos-12} times.`:``}`,
2418
+ "eyebrowDist":`${mii.eyebrows.distApart!==2?`On the eyebrow page (fifth tab), `:``}${mii.eyebrows.distanceApart<2?`press the closer-together button ${2-mii.eyebrows.distanceApart} times.`:mii.eyebrows.distanceApart>2?`press the further-apart button ${mii.eyebrows.distanceApart-2} times.`:``}`,
2419
+ "eyeType":`On the eye page (sixth tab), set the eye type to the one ${typeCheat[mii.eyes.type]} from the left, ${Math.ceil((mii.eyes.type+1)/3)} from the top, on page ${mii.eyes.page}.`,
2420
+ "eyeColor":`On the eye page (sixth tab), set the color to the one ${mii.eyes.color+(mii.eyes.color>2?-2:1)} from the left, on the ${mii.eyes.color>2?`bottom`:`top`} row.`,
2421
+ "eyeY":`${mii.eyes.yPos!==12?`On the eye page (sixth tab), `:``}${mii.eyes.yPosition<12?`press the up button ${12-mii.eyes.yPosition} times.`:mii.eyes.yPosition>12?`press the down button ${mii.eyes.yPosition-12} times.`:``}`,
2542
2422
  "eyeSize":`${mii.eyes.size!==4?`On the eye page (sixth tab), `:``}${mii.eyes.size<4?`press the shrink button ${4-mii.eyes.size} times.`:mii.eyes.size>4?`press the enlarge button ${mii.eyes.size-4} times.`:``}`,
2543
- "eyeRot":`${mii.eyes.rotation!==(mii.info.gender==="Female"?3:4)?`On the eye page (sixth tab), `:``}${mii.eyes.rotation<(mii.info.gender==="Female"?3:4)?`press the rotate clockwise button ${(mii.info.gender==="Female"?3:4)-mii.eyes.rotation} times.`:mii.eyes.rotation>(mii.info.gender==="Female"?3:4)?`press the rotate counter-clockwise button ${mii.eyes.rotation-(mii.info.gender==="Female"?3:4)} times.`:``}`,
2544
- "eyeDist":`${mii.eyes.distApart!==2?`On the eye page (sixth tab), `:``}${mii.eyes.distApart<2?`press the closer-together button ${2-mii.eyes.distApart} times.`:mii.eyes.distApart>2?`press the further-apart button ${mii.eyes.distApart-2} times.`:``}`,
2545
- "noseType":`On the nose page (seventh tab), set the nose to the one ${Math.ceil((mii.nose.type+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.nose.type]} from the left.`,
2546
- "noseY":`${mii.nose.yPos!==9?`On the nose page (seventh tab), `:``}${mii.nose.yPos<9?`press the up button ${9-mii.nose.yPos} times.`:mii.nose.yPos>9?`press the down button ${mii.nose.yPos-9} times.`:``}`,
2423
+ "eyeRot":`${mii.eyes.rotation!==(mii.general.gender==="Female"?3:4)?`On the eye page (sixth tab), `:``}${mii.eyes.rotation<(mii.general.gender==="Female"?3:4)?`press the rotate clockwise button ${(mii.general.gender==="Female"?3:4)-mii.eyes.rotation} times.`:mii.eyes.rotation>(mii.general.gender==="Female"?3:4)?`press the rotate counter-clockwise button ${mii.eyes.rotation-(mii.general.gender==="Female"?3:4)} times.`:``}`,
2424
+ "eyeDist":`${mii.eyes.distanceApart!==2?`On the eye page (sixth tab), `:``}${mii.eyes.distanceApart<2?`press the closer-together button ${2-mii.eyes.distanceApart} times.`:mii.eyes.distanceApart>2?`press the further-apart button ${mii.eyes.distanceApart-2} times.`:``}`,
2425
+ "noseType":`On the nose page (seventh tab), set the nose to the one ${Math.ceil((mii.nose.type+1)/3)} from the top, and ${typeCheat[mii.nose.type]} from the left.`,
2426
+ "noseY":`${mii.nose.yPosition!==9?`On the nose page (seventh tab), `:``}${mii.nose.yPosition<9?`press the up button ${9-mii.nose.yPosition} times.`:mii.nose.yPosition>9?`press the down button ${mii.nose.yPosition-9} times.`:``}`,
2547
2427
  "noseSize":`${mii.nose.size!==4?`On the nose page (seventh tab), `:``}${mii.nose.size<4?`press the shrink button ${4-mii.nose.size} times.`:mii.nose.size>4?`press the enlarge button ${mii.nose.size-4} times.`:``}`,
2548
- "mouthType":`On the mouth page (eighth tab), set the mouth type to the one ${mii.mouth.type[1]} from the left, ${mii.mouth.type[2]} from the top, on page ${mii.mouth.type[0]}.`,
2549
- "mouthCol":`On the mouth page (eighth tab), set the color to the one ${wiiMouthColors.indexOf(mii.mouth.col)+1} from the left.`,
2550
- "mouthY":`${mii.mouth.yPos!==13?`On the mouth page (eighth tab), `:``}${mii.mouth.yPos<13?`press the up button ${13-mii.mouth.yPos} times.`:mii.mouth.yPos>13?`press the down button ${mii.mouth.yPos-13} times.`:``}`,
2428
+ "mouthType":`On the mouth page (eighth tab), set the mouth type to the one ${typeCheat[mii.mouth.type]} from the left, ${Math.ceil((mii.mouth.type+1)/3)} from the top, on page ${mii.mouth.page}.`,
2429
+ "mouthCol":`On the mouth page (eighth tab), set the color to the one ${mii.mouth.col+1} from the left.`,
2430
+ "mouthY":`${mii.mouth.yPosition!==13?`On the mouth page (eighth tab), `:``}${mii.mouth.yPosition<13?`press the up button ${13-mii.mouth.yPosition} times.`:mii.mouth.yPosition>13?`press the down button ${mii.mouth.yPosition-13} times.`:``}`,
2551
2431
  "mouthSize":`${mii.mouth.size!==4?`On the mouth page (eighth tab), `:``}${mii.mouth.size<4?`press the shrink button ${4-mii.mouth.size} times.`:mii.mouth.size>4?`press the enlarge button ${mii.mouth.size-4} times.`:``}`,
2552
- "glasses":`On the glasses page (within the ninth tab), set the glasses to the one ${Math.ceil((mii.glasses.type+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.glasses.type]} from the left.`,
2553
- "glassesCol":`On the glasses page (within the ninth tab), set the color to the one ${wiiGlassesCols.indexOf(mii.glasses.col)+(wiiGlassesCols.indexOf(mii.glasses.col)>2?-2:1)} from the left, on the ${wiiGlassesCols.indexOf(mii.glasses.col)>2?`bottom`:`top`} row.`,
2554
- "glassesY":`${mii.glasses.yPos!==10?`On the glasses page (within the ninth tab), `:``}${mii.glasses.yPos<10?`press the up button ${10-mii.glasses.yPos} times.`:mii.glasses.yPos>10?`press the down button ${mii.glasses.yPos-10} times.`:``}`,
2432
+ "glasses":`On the glasses page (within the ninth tab), set the glasses to the one ${Math.ceil((mii.glasses.type+1)/3)} from the top, and ${typeCheat[mii.glasses.type]} from the left.`,
2433
+ "glassesCol":`On the glasses page (within the ninth tab), set the color to the one ${mii.glasses.color+(mii.glasses.color>2?-2:1)} from the left, on the ${mii.glasses.color>2?`bottom`:`top`} row.`,
2434
+ "glassesY":`${mii.glasses.yPosition!==10?`On the glasses page (within the ninth tab), `:``}${mii.glasses.yPosition<10?`press the up button ${10-mii.glasses.yPosition} times.`:mii.glasses.yPosition>10?`press the down button ${mii.glasses.yPosition-10} times.`:``}`,
2555
2435
  "glassesSize":`${mii.glasses.size!==4?`On the glasses page (within the ninth tab), `:``}${mii.glasses.size<4?`press the shrink button ${4-mii.glasses.size} times.`:mii.glasses.size>4?`press the enlarge button ${mii.glasses.size-4} times.`:``}`,
2556
- "stache":`On the mustache page (within the ninth tab), set the mustache to the one on the ${[0,1].includes(mii.facialHair.mustacheType)?`top`:`bottom`}-${[0,2].includes(mii.facialHair.mustacheType)?`left`:`right`}.`,
2557
- "stacheY":`${mii.facialHair.mustacheYPos!==10?`On the mustache page (within the ninth tab), press the `:``}${mii.facialHair.mustacheYPos>10?`down button ${mii.facialHair.mustacheYPos-10} times.`:mii.facialHair.mustacheYPos<10?`up button ${10-mii.facialHair.mustacheYPos} times.`:``}`,
2558
- "stacheSize":`${mii.facialHair.mustacheSize!==4?`On the mustache page (within the ninth tab), `:``}${mii.facialHair.mustacheSize<4?`press the shrink button ${4-mii.facialHair.mustacheSize} times.`:mii.facialHair.mustacheSize>4?`press the enlarge button ${mii.facialHair.mustacheSize-4} times.`:``}`,
2436
+ "stache":`On the mustache page (within the ninth tab), set the mustache to the one on the ${[0,1].includes(mii.beard.mustache.type)?`top`:`bottom`}-${[0,2].includes(mii.beard.mustache.type)?`left`:`right`}.`,
2437
+ "stacheY":`${mii.beard.mustache.yPosition!==10?`On the mustache page (within the ninth tab), press the `:``}${mii.beard.mustache.yPos>10?`down button ${mii.beard.mustache.yPos-10} times.`:mii.beard.mustache.yPos<10?`up button ${10-mii.beard.mustache.yPos} times.`:``}`,
2438
+ "stacheSize":`${mii.beard.mustache.size!==4?`On the mustache page (within the ninth tab), `:``}${mii.beard.mustache.size<4?`press the shrink button ${4-mii.beard.mustache.size} times.`:mii.beard.mustache.size>4?`press the enlarge button ${mii.beard.mustache.size-4} times.`:``}`,
2559
2439
  "mole":`${mii.mole.on?`On the mole page (within the ninth tab), turn the mole on.`:``}`,
2560
- "moleX":`${mii.mole.xPos!==2?`On the mole page (within the ninth tab), press the `:``}${mii.mole.xPos>2?`right button ${mii.mole.xPos-2} times.`:mii.mole.xPos<2?`left button ${2-mii.mole.xPos} times.`:``}`,
2561
- "moleY":`${mii.mole.yPos!==20?`On the mole page (within the ninth tab), press the `:``}${mii.mole.yPos>20?`down button ${mii.mole.yPos-20} times.`:mii.mole.yPos<20?`up button ${20-mii.mole.yPos} times.`:``}`,
2440
+ "moleX":`${mii.mole.xPosition!==2?`On the mole page (within the ninth tab), press the `:``}${mii.mole.xPosition>2?`right button ${mii.mole.xPosition-2} times.`:mii.mole.xPosition<2?`left button ${2-mii.mole.xPosition} times.`:``}`,
2441
+ "moleY":`${mii.mole.yPosition!==20?`On the mole page (within the ninth tab), press the `:``}${mii.mole.yPosition>20?`down button ${mii.mole.yPosition-20} times.`:mii.mole.yPosition<20?`up button ${20-mii.mole.yPosition} times.`:``}`,
2562
2442
  "moleSize":`${mii.mole.size!==4?`On the mole page (within the ninth tab), `:``}${mii.mole.size<4?`press the shrink button ${4-mii.mole.size} times.`:mii.mole.size>4?`press the enlarge button ${mii.mole.size-4} times.`:``}`,
2563
- "beard":`On the beard page (within the ninth tab), set the beard to the one on the ${[0,1].includes(mii.facialHair.beardType)?`top`:`bottom`}-${[0,2].includes(mii.facialHair.beardType)?`left`:`right`}.`,
2564
- "beardCol":`On the mustache OR beard pages (within the ninth tab), set the color to the one ${hairCols.indexOf(mii.facialHair.col)+(hairCols.indexOf(mii.facialHair.col)>3?-3:1)} from the left, on the ${hairCols.indexOf(mii.facialHair.col)>3?`bottom`:`top`} row.`,
2443
+ "beard":`On the beard page (within the ninth tab), set the beard to the one on the ${[0,1].includes(mii.beard.type)?`top`:`bottom`}-${[0,2].includes(mii.beard.type)?`left`:`right`}.`,
2444
+ "beardCol":`On the mustache OR beard pages (within the ninth tab), set the color to the one ${mii.beard.col+(mii.beard.col>3?-3:1)} from the left, on the ${mii.facialHair.col>3?`bottom`:`top`} row.`,
2565
2445
  "other":`The Nickname of this Mii is ${mii.info.name}.${mii.info.creatorName?` The creator was ${mii.info.creatorName}.`:``} Mingle was turned ${mii.info.mingle?`on`:`off`}.${mii.info.birthday!==0?` Its birthday is ${["","January","February","March","April","May","June","July","August","September","October","November","December"][mii.info.birthMonth]} ${mii.info.birthday}.`:``}`
2566
2446
  };
2567
2447
  if(!full){
2568
- var defaultMiiInstrs=structuredClone(mii.info.gender==="Male"?defaultInstrs.wii.male:defaultInstrs.wii.female);
2448
+ var defaultMiiInstrs=structuredClone(mii.general.gender==="Male"?defaultInstrs.wii.male:defaultInstrs.wii.female);
2569
2449
  Object.keys(instrs).forEach(instr=>{
2570
2450
  if(instrs[instr]===defaultMiiInstrs[instr]){
2571
2451
  delete instrs[instr];
@@ -2576,55 +2456,55 @@ function generateInstructions(mii,full){
2576
2456
  }
2577
2457
  else{
2578
2458
  var instrs={
2579
- "base":`Select "Start from Scratch", and then "${mii.info.gender}".`,
2580
- "faceShape":`On the face page (first tab), set the face shape to the one ${Math.ceil((mii.face.shape+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.face.shape]} from the left.`,
2581
- "skinCol":`On the face page (first tab), set the color to the one ${skinCols.indexOf(mii.face.col)+1} from the top.`,
2582
- "makeup":`On the face page's makeup tab, set the makeup to \"${mii.face.makeup}\" (the one ${Math.ceil((makeups3DS.indexOf(mii.face.makeup)+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][makeups3DS.indexOf(mii.face.makeup)]} from the left).`,
2583
- "feature":`On the face page's wrinkles tab, set the facial feature to \"${mii.face.feature}\" (the one ${Math.ceil((faceFeatures3DS.indexOf(mii.face.feature)+1)/3)+1} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][makeups3DS.indexOf(mii.face.makeup)]} from the left).`,
2584
- "hairStyle":`On the hair page (second tab), set the hair style to the one ${Math.ceil((mii.hair.style[1]+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.hair.style[1]]} from the left, on page ${mii.hair.style[0]+1}.`,
2459
+ "base":`Select "Start from Scratch", and then "${mii.general.gender}".`,
2460
+ "faceShape":`On the face page (first tab), set the face shape to the one ${Math.ceil((mii.face.type+1)/3)} from the top, and ${typeCheat[mii.face.type]} from the left.`,
2461
+ "skinCol":`On the face page (first tab), set the color to the one ${mii.face.color+1} from the top.`,
2462
+ "makeup":`On the face page's makeup tab, set the makeup to the one ${Math.ceil((mii.face.makeup+1)/3)} from the top, and ${typeCheat[mii.face.makeup]} from the left.`,
2463
+ "feature":`On the face page's wrinkles tab, set the facial feature to the one ${Math.ceil((mii.face.feature+1)/3)+1} from the top, and ${typeCheat[mii.face.makeup]} from the left.`,
2464
+ "hairStyle":`On the hair page (second tab), set the hair style to the one ${Math.ceil((mii.hair.type+1)/3)} from the top, and ${typeCheat[mii.hair.type]} from the left, on page ${mii.hair.page+1}.`,
2585
2465
  "hairFlipped":`${mii.hair.flipped?`On the hair page (second tab), press the button to flip the hair.`:``}`,
2586
- "hairColor":`On the hair page (second tab), set the hair color to the one ${hairCols.indexOf(mii.hair.col)+1} from the top.`,
2587
- "eyebrowStyle":`On the eyebrow page (third tab), set the eyebrow style to the one ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.eyebrows.style[1]]} from the left, ${Math.ceil((mii.eyebrows.style[1]+1)/3)} from the top, on page ${mii.eyebrows.style[0]+1}.`,
2588
- "eyebrowColor":`On the eyebrow page (third tab), set the eyebrow color to the one ${hairCols.indexOf(mii.eyebrows.col)+1} from the top.`,
2589
- "eyebrowY":`${mii.eyebrows.yPos!==7?`On the eyebrow page (third tab), `:``}${mii.eyebrows.yPos<7?`press the up button ${7-mii.eyebrows.yPos} times.`:mii.eyebrows.yPos>7?`press the down button ${mii.eyebrows.yPos-7} times.`:``}`,
2466
+ "hairColor":`On the hair page (second tab), set the hair color to the one ${mii.hair.color+1} from the top.`,
2467
+ "eyebrowStyle":`On the eyebrow page (third tab), set the eyebrow style to the one ${typeCheat[mii.eyebrows.type]} from the left, ${Math.ceil((mii.eyebrows.type+1)/3)} from the top, on page ${mii.eyebrows.page+1}.`,
2468
+ "eyebrowColor":`On the eyebrow page (third tab), set the eyebrow color to the one ${mii.eyebrows.color+1} from the top.`,
2469
+ "eyebrowY":`${mii.eyebrows.yPosition!==7?`On the eyebrow page (third tab), `:``}${mii.eyebrows.yPosition<7?`press the up button ${7-mii.eyebrows.yPosition} times.`:mii.eyebrows.yPosition>7?`press the down button ${mii.eyebrows.yPosition-7} times.`:``}`,
2590
2470
  "eyebrowSize":`${mii.eyebrows.size!==4?`On the eyebrow page (third tab), `:``}${mii.eyebrows.size<4?`press the shrink button ${4-mii.eyebrows.size} times.`:mii.eyebrows.size>4?`press the enlarge button ${mii.eyebrows.size-4} times.`:``}`,
2591
- "eyebrowRot":`${mii.eyebrows.rot!==6?`On the eyebrow page (third tab), `:``}${mii.eyebrows.rot<6?`press the rotate clockwise button ${6-mii.eyebrows.rot} times.`:mii.eyebrows.rot>6?`press the rotate counter-clockwise button ${mii.eyebrows.rot-6} times.`:``}`,
2592
- "eyebrowDist":`${mii.eyebrows.distApart!==2?`On the eyebrow page (third tab), `:``}${mii.eyebrows.distApart<2?`press the closer-together button ${2-mii.eyebrows.distApart} times.`:mii.eyebrows.distApart>2?`press the further-apart button ${mii.eyebrows.distApart-2} times.`:``}`,
2471
+ "eyebrowRot":`${mii.eyebrows.rotation!==6?`On the eyebrow page (third tab), `:``}${mii.eyebrows.rotation<6?`press the rotate clockwise button ${6-mii.eyebrows.rotation} times.`:mii.eyebrows.rotation>6?`press the rotate counter-clockwise button ${mii.eyebrows.rotation-6} times.`:``}`,
2472
+ "eyebrowDist":`${mii.eyebrows.distanceApart!==2?`On the eyebrow page (third tab), `:``}${mii.eyebrows.distanceApart<2?`press the closer-together button ${2-mii.eyebrows.distanceApart} times.`:mii.eyebrows.distanceApart>2?`press the further-apart button ${mii.eyebrows.distanceApart-2} times.`:``}`,
2593
2473
  "eyebrowSquash":`${mii.eyebrows.squash!==3?`On the eyebrow page (third tab), `:``}${mii.eyebrows.squash<3?`press the squish button ${3-mii.eyebrows.squash} times.`:mii.eyebrows.squash>3?`press the un-squish button ${mii.eyebrows.squash-3} times.`:``}`,
2594
- "eyeType":`On the eye page (fourth tab), set the eye type to the one ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.eyes.type[1]]} from the left, ${Math.ceil((mii.eyes.type[1]+1)/3)} from the top, on page ${mii.eyes.type[0]+1}.`,
2595
- "eyeColor":`On the eye page (fourth tab), set the color to the one ${eyeCols.indexOf(mii.eyes.col)+1} from the top.`,
2596
- "eyeY":`${mii.eyes.yPos!==12?`On the eye page (fourth tab), `:``}${mii.eyes.yPos<12?`press the up button ${12-mii.eyes.yPos} times.`:mii.eyes.yPos>12?`press the down button ${mii.eyes.yPos-12} times.`:``}`,
2474
+ "eyeType":`On the eye page (fourth tab), set the eye type to the one ${typeCheat[mii.eyes.type]} from the left, ${Math.ceil((mii.eyes.type+1)/3)} from the top, on page ${mii.eyes.page+1}.`,
2475
+ "eyeColor":`On the eye page (fourth tab), set the color to the one ${mii.eyes.col+1} from the top.`,
2476
+ "eyeY":`${mii.eyes.yPosition!==12?`On the eye page (fourth tab), `:``}${mii.eyes.yPosition<12?`press the up button ${12-mii.eyes.yPosition} times.`:mii.eyes.yPosition>12?`press the down button ${mii.eyes.yPosition-12} times.`:``}`,
2597
2477
  "eyeSize":`${mii.eyes.size!==4?`On the eye page (fourth tab), `:``}${mii.eyes.size<4?`press the shrink button ${4-mii.eyes.size} times.`:mii.eyes.size>4?`press the enlarge button ${mii.eyes.size-4} times.`:``}`,
2598
- "eyeRot":`${mii.eyes.rot!==(mii.info.gender==="Female"?3:4)?`On the eye page (fourth tab), `:``}${mii.eyes.rot<(mii.info.gender==="Female"?3:4)?`press the rotate clockwise button ${(mii.info.gender==="Female"?3:4)-mii.eyes.rot} times.`:mii.eyes.rot>(mii.info.gender==="Female"?3:4)?`press the rotate counter-clockwise button ${mii.eyes.rot-(mii.info.gender==="Female"?3:4)} times.`:``}`,
2599
- "eyeDist":`${mii.eyes.distApart!==2?`On the eye page (fourth tab), `:``}${mii.eyes.distApart<2?`press the closer-together button ${2-mii.eyes.distApart} times.`:mii.eyes.distApart>2?`press the further-apart button ${mii.eyes.distApart-2} times.`:``}`,
2478
+ "eyeRot":`${mii.eyes.rotation!==(mii.general.gender==="Female"?3:4)?`On the eye page (fourth tab), `:``}${mii.eyes.rotation<(mii.general.gender==="Female"?3:4)?`press the rotate clockwise button ${(mii.general.gender==="Female"?3:4)-mii.eyes.rotation} times.`:mii.eyes.rotation>(mii.general.gender==="Female"?3:4)?`press the rotate counter-clockwise button ${mii.eyes.rotation-(mii.general.gender==="Female"?3:4)} times.`:``}`,
2479
+ "eyeDist":`${mii.eyes.distanceApart!==2?`On the eye page (fourth tab), `:``}${mii.eyes.distanceApart<2?`press the closer-together button ${2-mii.eyes.distanceApart} times.`:mii.eyes.distanceApart>2?`press the further-apart button ${mii.eyes.distanceApart-2} times.`:``}`,
2600
2480
  "eyeSquash":`${mii.eyes.squash!==3?`On the eye page (fourth tab), `:``}${mii.eyes.squash<3?`press the squish button ${3-mii.eyes.squash} times.`:mii.eyes.squash>3?`press the un-squish button ${mii.eyes.squash-3} times.`:``}`,
2601
- "noseType":`On the nose page (fifth tab), set the nose to the one ${Math.ceil((mii.nose.type[1]+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.nose.type[1]]} from the left, on page ${mii.nose.type[0]}.`,
2602
- "noseY":`${mii.nose.yPos!==9?`On the nose page (fifth tab), `:``}${mii.nose.yPos<9?`press the up button ${9-mii.nose.yPos} times.`:mii.nose.yPos>9?`press the down button ${mii.nose.yPos-9} times.`:``}`,
2481
+ "noseType":`On the nose page (fifth tab), set the nose to the one ${Math.ceil((mii.nose.type+1)/3)} from the top, and ${typeCheat[mii.nose.type]} from the left, on page ${mii.nose.page}.`,
2482
+ "noseY":`${mii.nose.yPosition!==9?`On the nose page (fifth tab), `:``}${mii.nose.yPosition<9?`press the up button ${9-mii.nose.yPosition} times.`:mii.nose.yPosition>9?`press the down button ${mii.nose.yPosition-9} times.`:``}`,
2603
2483
  "noseSize":`${mii.nose.size!==4?`On the nose page (fifth tab), `:``}${mii.nose.size<4?`press the shrink button ${4-mii.nose.size} times.`:mii.nose.size>4?`press the enlarge button ${mii.nose.size-4} times.`:``}`,
2604
- "mouthType":`On the mouth page (sixth tab), set the mouth type to the one ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.mouth.type[1]]} from the left, ${Math.ceil((mii.mouth.type[1]+1)/3)} from the top, on page ${mii.mouth.type[0]+1}.`,
2605
- "mouthCol":`On the mouth page (sixth tab), set the color to the one ${mouthCols3DS.indexOf(mii.mouth.col)+1} from the top.`,
2606
- "mouthY":`${mii.mouth.yPos!==13?`On the mouth page (sixth tab), `:``}${mii.mouth.yPos<13?`press the up button ${13-mii.mouth.yPos} times.`:mii.mouth.yPos>13?`press the down button ${mii.mouth.yPos-13} times.`:``}`,
2484
+ "mouthType":`On the mouth page (sixth tab), set the mouth type to the one ${typeCheat[mii.mouth.type]} from the left, ${Math.ceil((mii.mouth.type+1)/3)} from the top, on page ${mii.mouth.page+1}.`,
2485
+ "mouthCol":`On the mouth page (sixth tab), set the color to the one ${mii.mouth.color+1} from the top.`,
2486
+ "mouthY":`${mii.mouth.yPosition!==13?`On the mouth page (sixth tab), `:``}${mii.mouth.yPosition<13?`press the up button ${13-mii.mouth.yPosition} times.`:mii.mouth.yPosition>13?`press the down button ${mii.mouth.yPosition-13} times.`:``}`,
2607
2487
  "mouthSize":`${mii.mouth.size!==4?`On the mouth page (sixth tab), `:``}${mii.mouth.size<4?`press the shrink button ${4-mii.mouth.size} times.`:mii.mouth.size>4?`press the enlarge button ${mii.mouth.size-4} times.`:``}`,
2608
2488
  "mouthSquash":`${mii.mouth.squash!==3?`On the mouth page (sixth tab), `:``}${mii.mouth.squash<3?`press the squish button ${3-mii.mouth.squash} times.`:mii.mouth.squash>3?`press the un-squish button ${mii.mouth.squash-3} times.`:``}`,
2609
- "glasses":`On the glasses page (within the seventh tab), set the glasses to the one ${Math.ceil((mii.glasses.type+1)/3)} from the top, and ${[1,2,3,1,2,3,1,2,3,1,2,3][mii.glasses.type]} from the left.`,
2610
- "glassesCol":`On the glasses page (within the seventh tab), set the color to the one ${glassesCols3DS.indexOf(mii.glasses.col)+1} from the top.`,
2611
- "glassesY":`${mii.glasses.yPos!==10?`On the glasses page (within the seventh tab), `:``}${mii.glasses.yPos<10?`press the up button ${10-mii.glasses.yPos} times.`:mii.glasses.yPos>10?`press the down button ${mii.glasses.yPos-10} times.`:``}`,
2489
+ "glasses":`On the glasses page (within the seventh tab), set the glasses to the one ${Math.ceil((mii.glasses.type+1)/3)} from the top, and ${typeCheat[mii.glasses.type]} from the left.`,
2490
+ "glassesCol":`On the glasses page (within the seventh tab), set the color to the one ${mii.glasses.col+1} from the top.`,
2491
+ "glassesY":`${mii.glasses.yPosition!==10?`On the glasses page (within the seventh tab), `:``}${mii.glasses.yPosition<10?`press the up button ${10-mii.glasses.yPosition} times.`:mii.glasses.yPosition>10?`press the down button ${mii.glasses.yPosition-10} times.`:``}`,
2612
2492
  "glassesSize":`${mii.glasses.size!==4?`On the glasses page (within the seventh tab), `:``}${mii.glasses.size<4?`press the shrink button ${4-mii.glasses.size} times.`:mii.glasses.size>4?`press the enlarge button ${mii.glasses.size-4} times.`:``}`,
2613
- "stache":`On the mustache page (within the seventh tab), set the mustache to the one on the ${[0,1].includes(mii.facialHair.mustacheType)?`top`:[2,3].includes(mii.facialHair.mustacheType)?`middle`:`bottom`}-${[0,2,4].includes(mii.facialHair.mustacheType)?`left`:`right`}.`,
2614
- "stacheY":`${mii.facialHair.mustacheYPos!==10?`On the mustache page (within the seventh tab), press the `:``}${mii.facialHair.mustacheYPos>10?`down button ${mii.facialHair.mustacheYPos-10} times.`:mii.facialHair.mustacheYPos<10?`up button ${10-mii.facialHair.mustacheYPos} times.`:``}`,
2615
- "stacheSize":`${mii.facialHair.mustacheSize!==4?`On the mustache page (within the seventh tab), `:``}${mii.facialHair.mustacheSize<4?`press the shrink button ${4-mii.facialHair.mustacheSize} times.`:mii.facialHair.mustacheSize>4?`press the enlarge button ${mii.facialHair.mustacheSize-4} times.`:``}`,
2493
+ "stache":`On the mustache page (within the seventh tab), set the mustache to the one on the ${[0,1].includes(mii.beard.mustache.type)?`top`:[2,3].includes(mii.beard.mustache.type)?`middle`:`bottom`}-${[0,2,4].includes(mii.beard.mustache.type)?`left`:`right`}.`,
2494
+ "stacheY":`${mii.beard.mustache.yPosition!==10?`On the mustache page (within the seventh tab), press the `:``}${mii.beard.mustache.yPosition>10?`down button ${mii.beard.mustache.yPosition-10} times.`:mii.beard.mustache.yPosition<10?`up button ${10-mii.beard.mustache.yPosition} times.`:``}`,
2495
+ "stacheSize":`${mii.beard.mustache.size!==4?`On the mustache page (within the seventh tab), `:``}${mii.beard.mustache.size<4?`press the shrink button ${4-mii.beard.mustache.size} times.`:mii.beard.mustache.size>4?`press the enlarge button ${mii.beard.mustache.size-4} times.`:``}`,
2616
2496
  "mole":`${mii.mole.on?`On the mole page (within the seventh tab), turn the mole on.`:``}`,
2617
- "moleX":`${mii.mole.xPos!==2?`On the mole page (within the seventh tab), press the `:``}${mii.mole.xPos>2?`right button ${mii.mole.xPos-2} times.`:mii.mole.xPos<2?`left button ${2-mii.mole.xPos} times.`:``}`,
2618
- "moleY":`${mii.mole.yPos!==20?`On the mole page (within the seventh tab), press the `:``}${mii.mole.yPos>20?`down button ${mii.mole.yPos-20} times.`:mii.mole.yPos<20?`up button ${20-mii.mole.yPos} times.`:``}`,
2497
+ "moleX":`${mii.mole.xPosition!==2?`On the mole page (within the seventh tab), press the `:``}${mii.mole.xPosition>2?`right button ${mii.mole.xPosition-2} times.`:mii.mole.xPosition<2?`left button ${2-mii.mole.xPosition} times.`:``}`,
2498
+ "moleY":`${mii.mole.yPosition!==20?`On the mole page (within the seventh tab), press the `:``}${mii.mole.yPosition>20?`down button ${mii.mole.yPosition-20} times.`:mii.mole.yPosition<20?`up button ${20-mii.mole.yPosition} times.`:``}`,
2619
2499
  "moleSize":`${mii.mole.size!==4?`On the mole page (within the seventh tab), `:``}${mii.mole.size<4?`press the shrink button ${4-mii.mole.size} times.`:mii.mole.size>4?`press the enlarge button ${mii.mole.size-4} times.`:``}`,
2620
- "beard":`On the beard page (within the seventh tab), set the beard to the one on the ${[0,1].includes(mii.facialHair.beardType)?`top`:[2,3].includes(mii.facialHair.beardType)?`middle`:`bottom`}-${[0,2].includes(mii.facialHair.beardType)?`left`:`right`}.`,
2621
- "beardCol":`On the mustache OR beard pages (within the seventh tab), set the color to the one ${hairCols.indexOf(mii.facialHair.col)+1} from the top.`,
2622
- "heightWeight":`On the build page (eighth tab), set the height to ${Math.round((100/128)*mii.info.height)}%, and the weight to ${Math.round((100/128)*mii.info.weight)}%.`,
2623
- "col":`On the info page (after pressing "Next"), set the Favorite Color to ${mii.info.favColor} (${favCols.indexOf(mii.info.favColor)<=5?favCols.indexOf(mii.info.favColor)+1:favCols.indexOf(mii.info.favColor)-5} from the left, ${favCols.indexOf(mii.info.favColor)>5?"bottom":"top"} row).`,
2624
- "other":`The Nickname of this Mii is ${mii.info.name}.${mii.info.creatorName?` The creator was ${mii.info.creatorName}.`:``} ${mii.info.birthday!==0?` Its birthday is ${["","January","February","March","April","May","June","July","August","September","October","November","December"][mii.info.birthMonth]} ${mii.info.birthday}.`:``}`
2500
+ "beard":`On the beard page (within the seventh tab), set the beard to the one on the ${[0,1].includes(mii.beard.type)?`top`:[2,3].includes(mii.beard.type)?`middle`:`bottom`}-${[0,2].includes(mii.beard.type)?`left`:`right`}.`,
2501
+ "beardCol":`On the mustache OR beard pages (within the seventh tab), set the color to the one ${mii.beard.color+1} from the top.`,
2502
+ "heightWeight":`On the build page (eighth tab), set the height to ${Math.round((100/128)*mii.general.height)}%, and the weight to ${Math.round((100/128)*mii.general.weight)}%.`,
2503
+ "col":`On the info page (after pressing "Next"), set the Favorite Color to ${mii.general.favoriteColor} (${mii.general.favoriteColor<=5?mii.general.favoriteColor+1:mii.general.favoriteColor-5} from the left, ${mii.general.favoriteColor>5?"bottom":"top"} row).`,
2504
+ "other":`The Nickname of this Mii is ${mii.general.name}.${mii.general.creatorName?` The creator was ${mii.general.creatorName}.`:``} ${mii.general.birthday!==0?` Its birthday is ${["","January","February","March","April","May","June","July","August","September","October","November","December"][mii.general.birthMonth]} ${mii.general.birthday}.`:``}`
2625
2505
  };
2626
2506
  if(!full){
2627
- var defaultMiiInstrs=structuredClone(mii.info.gender==="Male"?defaultInstrs["3ds"].male:defaultInstrs["3ds"].female);
2507
+ var defaultMiiInstrs=structuredClone(mii.general.gender==="Male"?defaultInstrs["3ds"].male:defaultInstrs["3ds"].female);
2628
2508
  Object.keys(instrs).forEach(instr=>{
2629
2509
  if(instrs[instr]===defaultMiiInstrs[instr]){
2630
2510
  delete instrs[instr];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miijs",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "Work with Mii characters in every possible way needed for your project.",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -34,6 +34,7 @@
34
34
  "jsqr": "^1.4.0",
35
35
  "path": "^0.12.7",
36
36
  "qr-code-styling": "^1.9.2",
37
+ "require-esm-in-cjs": "^0.1.0",
37
38
  "three": "^0.162.0"
38
39
  },
39
40
  "devDependencies": {