miijs 1.6.7 → 1.6.9

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 (2) hide show
  1. package/index.js +9 -6
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -1110,13 +1110,17 @@ module.exports={
1110
1110
  const ctx = canvas.getContext('2d');
1111
1111
  ctx.drawImage(img, 0, 0);
1112
1112
  const imageData = ctx.getImageData(0, 0, canvas.width, canvas.height);
1113
- qrCode = jsQR(imageData.data, imageData.width, imageData.height);
1113
+ qrCode = jsQR(imageData.data, imageData.width, imageData.height).binaryData;
1114
1114
  }
1115
1115
  else{
1116
- qrCode=binOrPath;
1116
+ var d=binOrPath.match(/(0|1){1,8}/g);
1117
+ qrCode=[];
1118
+ d.forEach(byte=>{
1119
+ qrCode.push(parseInt(byte,2));
1120
+ });
1117
1121
  }
1118
1122
  if (qrCode) {
1119
- var data = decodeAesCcm(new Uint8Array(qrCode.binaryData));
1123
+ var data = decodeAesCcm(new Uint8Array(qrCode));
1120
1124
  fs.writeFileSync("./decryptedTemp.3dMii",Buffer.from(data));
1121
1125
  return Promise.resolve(readMii());
1122
1126
  } else {
@@ -1230,8 +1234,7 @@ module.exports={
1230
1234
  for(var i=0;i<toWrite.length;i++){
1231
1235
  buffers.push(parseInt(toWrite[i],2));
1232
1236
  }
1233
- const buffer = Buffer.from(buffers);
1234
- fs.writeFileSync(outPath, buffer);
1237
+ fs.writeFileSync(outPath, Buffer.from(buffers));
1235
1238
  },
1236
1239
  write3DSQR:function(jsonIn,outPath){
1237
1240
  var mii=jsonIn;
@@ -1757,7 +1760,7 @@ module.exports={
1757
1760
  "col": "Black",
1758
1761
  "mustacheSize": 4,
1759
1762
  "mustacheYPos": 10
1760
- }:dad.facialHair,
1763
+ }:Math.floor(Math.random()*2)===0?dad.facialHair:mom.facialHair,
1761
1764
  "glasses":Math.floor(Math.random()*2)===1?dad.glasses:mom.glasses,
1762
1765
  "mole":Math.floor(Math.random()*2)===1?dad.mole:mom.mole,
1763
1766
  "creatorName":""
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miijs",
3
- "version": "1.6.7",
3
+ "version": "1.6.9",
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": {