miijs 2.0.0 → 2.0.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.
Files changed (3) hide show
  1. package/README.md +2 -2
  2. package/index.js +10 -10
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -45,8 +45,8 @@ Here is a list of discrepancies this function attempts to handle.
45
45
  - 3DS and Wii U
46
46
  - Open Mii Maker, select "QR Code/Image Options", and then select the respective QR Code option, be it scanning a QR code or saving a Mii as a QR code.
47
47
 
48
- -# If you are unable to transfer to the console you wish to, you can use the `generateInstructions` function provided here and manually recreate the Mii on the console using the provided instructions.
48
+ <sub>If you are unable to transfer to the console you wish to, you can use the `generateInstructions` function provided here and manually recreate the Mii on the console using the provided instructions.</sub>
49
49
 
50
50
  # Credits
51
51
  - [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.
52
- - [ariankordi's FFL.js](https://github.com/ariankordi/FFL.js/), All files starting with /^ffl\*/i are from FFL.js, as well as `struct-fu.js`. They're here to support rendering the Miis locally. A lot of modifications had to be made to work in Node.js, and while it was a fair bit of work, it's far less than rewriting it from the ground up (Particularly as someone almost fully new to 3D rendering) and locally rendering Miis would not have been possible without this repo.
52
+ - [ariankordi's FFL.js](https://github.com/ariankordi/FFL.js/), All files starting with /^ffl\*/i are from FFL.js, as well as `struct-fu.js`. They're here to support rendering the Miis locally. A lot of modifications had to be made to work in Node.js, and while it was a fair bit of work, it's far less than rewriting it from the ground up (Particularly as someone almost fully new to 3D rendering) and locally rendering Miis would not have been possible without this repo.
package/index.js CHANGED
@@ -1276,7 +1276,7 @@ var exports={
1276
1276
  thisMii.facialHair.col=hairCols[parseInt(temp.slice(4,7),2)];//0-7
1277
1277
  thisMii.facialHair.mustacheSize=parseInt(temp[7]+temp2.slice(0,3),2);//0-30, default 20
1278
1278
  thisMii.facialHair.mustacheYPos=parseInt(temp2.slice(3,8),2);//0-16, default 2
1279
- thisMii.console="Wii";
1279
+ thisMii.console="wii";
1280
1280
  return thisMii;
1281
1281
  },
1282
1282
  read3DSQR:async function(binOrPath){
@@ -1387,7 +1387,7 @@ var exports={
1387
1387
  temp2=get(0x47);
1388
1388
  miiJson.mole.xPos=parseInt(temp2.slice(6,8)+temp.slice(0,3),2);
1389
1389
  miiJson.mole.yPos=parseInt(temp2.slice(1,6),2);
1390
- miiJson.console="3DS";
1390
+ miiJson.console="3ds";
1391
1391
  return miiJson;
1392
1392
  }
1393
1393
  let qrCode;
@@ -1414,8 +1414,8 @@ var exports={
1414
1414
  console.error('Failed to decode QR code');
1415
1415
  }
1416
1416
  },
1417
- writeWiiBin:function(jsonIn,outPath){
1418
- if(jsonIn.console?.toLowerCase()!=="wii"){
1417
+ writeWiiBin:function(jsonIn, outPath){
1418
+ if(jsonIn.console?.toLowerCase() !== "wii"){
1419
1419
  this.convertMii(jsonIn);
1420
1420
  }
1421
1421
  var mii=jsonIn;
@@ -1788,7 +1788,7 @@ var exports={
1788
1788
  })
1789
1789
  },
1790
1790
  render3DSMiiWithStudio:async function(jsonIn){
1791
- if(!["3ds","wii u"].includes(jsonIn.console)){
1791
+ if(!["3ds","wii u"].includes(jsonIn.console?.toLowerCase())){
1792
1792
  jsonIn=this.convertMii(jsonIn);
1793
1793
  }
1794
1794
  var studioMii=this.convert3DSMiiToStudio(jsonIn);
@@ -1889,7 +1889,7 @@ var exports={
1889
1889
  if(mii.facialHair.beardType>3){
1890
1890
  mii.facialHair.beardType=3;
1891
1891
  }
1892
- miiTo.console="Wii";
1892
+ miiTo.console="wii";
1893
1893
  }
1894
1894
  else if(typeFrom==="wii"){
1895
1895
  miiTo={
@@ -1965,7 +1965,7 @@ var exports={
1965
1965
  miiTo.mole.size=mii.mole.size;
1966
1966
  miiTo.mole.xPos=mii.mole.xPos;
1967
1967
  miiTo.mole.yPos=mii.mole.yPos;
1968
- miiTo.console="3DS";
1968
+ miiTo.console="3ds";
1969
1969
  }
1970
1970
  return miiTo;
1971
1971
  },
@@ -2029,7 +2029,7 @@ var exports={
2029
2029
  return child;
2030
2030
  },
2031
2031
  generateInstructions:function(mii,full){
2032
- let type=mii.console.toLowerCase();
2032
+ let type=mii.console?.toLowerCase();
2033
2033
  if(type.toLowerCase()==="wii"){
2034
2034
  var instrs={
2035
2035
  "base":`Select "${mii.info.gender}", and then "Start from Scratch".`,
@@ -2146,7 +2146,7 @@ var exports={
2146
2146
  }
2147
2147
  },
2148
2148
  convert3DSMiiToStudio:function(jsonIn){
2149
- if(!["3ds","wii u"].includes(jsonIn.console.toLowerCase())){
2149
+ if(!["3ds","wii u"].includes(jsonIn.console?.toLowerCase())){
2150
2150
  jsonIn=this.convertMii(jsonIn);
2151
2151
  }
2152
2152
  var mii=jsonIn;
@@ -2231,7 +2231,7 @@ var exports={
2231
2231
  return encodeStudio(studioMii);
2232
2232
  },
2233
2233
  render3DSMii:async function(jsonIn,fflRes=_fflRes){
2234
- if(!["3ds","wii u"].includes(jsonIn)){
2234
+ if(!["3ds","wii u"].includes(jsonIn.console?.toLowerCase())){
2235
2235
  jsonIn=this.convertMii(jsonIn);
2236
2236
  }
2237
2237
  return await renderMii(this.convert3DSMiiToStudio(jsonIn),fflRes);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miijs",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "Read, Edit, Write, and make Special Miis from a Wiimote binary file or 3DS QR Code to a binary file or QR code",
5
5
  "main": "index.js",
6
6
  "scripts": {