miijs 2.1.0 → 2.1.2

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/package.json CHANGED
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "miijs",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "description": "Work with Mii characters in every possible way needed for your project.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "jest"
7
+ "test": "jest",
8
+ "postinstall": "node ./patch-ffl.js"
8
9
  },
9
10
  "repository": {
10
11
  "type": "git",
@@ -26,7 +27,7 @@
26
27
  "homepage": "https://github.com/KestronProgramming/MiiJS#readme",
27
28
  "dependencies": {
28
29
  "canvas": "^3.1.0",
29
- "ffl.js": "github:ariankordi/FFL.js#4f83ae2",
30
+ "ffl.js": "github:ariankordi/FFL.js#06ede8f",
30
31
  "gl": "^8.1.6",
31
32
  "https": "^1.0.0",
32
33
  "jimp": "0.22.12",
@@ -34,6 +35,8 @@
34
35
  "jsqr": "^1.4.0",
35
36
  "path": "^0.12.7",
36
37
  "qr-code-styling": "^1.9.2",
38
+ "require-esm-in-cjs": "^0.1.0",
39
+ "struct-fu": "^1.2.1",
37
40
  "three": "^0.162.0"
38
41
  },
39
42
  "devDependencies": {
package/patch-ffl.js ADDED
@@ -0,0 +1,48 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ const fflPath = path.join(__dirname, './node_modules/ffl.js/ffl.js');
5
+
6
+ console.log('Patching ffl.js to have CJS Exports...');
7
+
8
+ if (!fs.existsSync(fflPath)) {
9
+ console.error('ffl.js not found at', fflPath);
10
+ process.exit(1);
11
+ }
12
+
13
+ let content = fs.readFileSync(fflPath, 'utf8');
14
+
15
+ // Check if already patched
16
+ if (content.includes('// MIIJS_PATCHED')) {
17
+ console.log('ffl.js already patched, skipping.');
18
+ process.exit(0);
19
+ }
20
+
21
+ content += `
22
+ // MIIJS_PATCHED - CommonJS exports for Node.js
23
+ if (typeof module !== 'undefined' && module.exports) {
24
+ module.exports = {
25
+ initializeFFL,
26
+ exitFFL,
27
+ createCharModel,
28
+ initCharModelTextures,
29
+ setIsWebGL1State,
30
+ parseHexOrB64ToUint8Array,
31
+ getCameraForViewType,
32
+ ViewType,
33
+ CharModel,
34
+ FFLExpression,
35
+ FFLModelFlag,
36
+ FFLResourceType,
37
+ makeExpressionFlag,
38
+ TextureShaderMaterial,
39
+ convertStudioCharInfoToFFLiCharInfo,
40
+ convertFFLiCharInfoToStudioCharInfo,
41
+ uint8ArrayToBase64
42
+ };
43
+ }
44
+ `;
45
+ content=content.replaceAll("console.debug","//console.debug");
46
+ fs.writeFileSync(fflPath, content, 'utf8');
47
+
48
+ console.log('ffl.js successfully patched.');
package/out.txt DELETED
@@ -1,178 +0,0 @@
1
- {
2
- "mouth": {
3
- "0": 6,
4
- "1": 1,
5
- "2": 2,
6
- "3": 4,
7
- "4": 5,
8
- "5": 5,
9
- "6": 10,
10
- "7": 0,
11
- "8": 7,
12
- "9": 1,
13
- "10": 8,
14
- "11": 7,
15
- "12": 11,
16
- "13": 11,
17
- "14": 10,
18
- "15": 6,
19
- "16": 9,
20
- "17": 3,
21
- "18": 9,
22
- "19": 2,
23
- "20": 8,
24
- "21": 3,
25
- "22": 4,
26
- "23": 0
27
- },
28
- "eyebrows": {
29
- "0": 1,
30
- "1": 3,
31
- "2": 2,
32
- "3": 3,
33
- "4": 11,
34
- "5": 10,
35
- "6": 0,
36
- "7": 6,
37
- "8": 8,
38
- "9": 4,
39
- "10": 1,
40
- "11": 0,
41
- "12": 2,
42
- "13": 7,
43
- "14": 4,
44
- "15": 6,
45
- "16": 10,
46
- "17": 9,
47
- "18": 9,
48
- "19": 5,
49
- "20": 5,
50
- "21": 7,
51
- "22": 8,
52
- "23": 11
53
- },
54
- "eyes": {
55
- "0": 2,
56
- "1": 6,
57
- "2": 0,
58
- "3": 6,
59
- "4": 1,
60
- "5": 0,
61
- "6": 5,
62
- "7": 0,
63
- "8": 3,
64
- "9": 4,
65
- "10": 9,
66
- "11": 1,
67
- "12": 5,
68
- "13": 2,
69
- "14": 10,
70
- "15": 9,
71
- "16": 8,
72
- "17": 5,
73
- "18": 9,
74
- "19": 2,
75
- "20": 11,
76
- "21": 8,
77
- "22": 8,
78
- "23": 6,
79
- "24": 6,
80
- "25": 9,
81
- "26": 7,
82
- "27": 10,
83
- "28": 10,
84
- "29": 5,
85
- "30": 7,
86
- "31": 8,
87
- "32": 3,
88
- "33": 0,
89
- "34": 7,
90
- "35": 11,
91
- "36": 3,
92
- "37": 4,
93
- "38": 2,
94
- "39": 4,
95
- "40": 10,
96
- "41": 1,
97
- "42": 3,
98
- "43": 7,
99
- "44": 1,
100
- "45": 4,
101
- "46": 11,
102
- "47": 11
103
- },
104
- "hairs": {
105
- "0": 11,
106
- "1": 6,
107
- "2": 5,
108
- "3": 1,
109
- "4": 4,
110
- "5": 8,
111
- "6": 4,
112
- "7": 11,
113
- "8": 9,
114
- "9": 3,
115
- "10": 3,
116
- "11": 6,
117
- "12": 0,
118
- "13": 1,
119
- "14": 0,
120
- "15": 10,
121
- "16": 1,
122
- "17": 8,
123
- "18": 4,
124
- "19": 7,
125
- "20": 5,
126
- "21": 10,
127
- "22": 2,
128
- "23": 3,
129
- "24": 9,
130
- "25": 5,
131
- "26": 3,
132
- "27": 10,
133
- "28": 6,
134
- "29": 11,
135
- "30": 9,
136
- "31": 11,
137
- "32": 0,
138
- "33": 0,
139
- "34": 11,
140
- "35": 9,
141
- "36": 6,
142
- "37": 2,
143
- "38": 1,
144
- "39": 4,
145
- "40": 1,
146
- "41": 7,
147
- "42": 2,
148
- "43": 0,
149
- "44": 3,
150
- "45": 6,
151
- "46": 2,
152
- "47": 1,
153
- "48": 3,
154
- "49": 7,
155
- "50": 7,
156
- "51": 2,
157
- "52": 5,
158
- "53": 7,
159
- "54": 5,
160
- "55": 8,
161
- "56": 9,
162
- "57": 10,
163
- "58": 6,
164
- "59": 8,
165
- "60": 10,
166
- "61": 0,
167
- "62": 11,
168
- "63": 7,
169
- "64": 9,
170
- "65": 8,
171
- "66": 4,
172
- "67": 4,
173
- "68": 10,
174
- "69": 2,
175
- "70": 5,
176
- "71": 8
177
- }
178
- }
package/stuff.js DELETED
@@ -1,208 +0,0 @@
1
- var types={
2
- mouth: {
3
- '0': '113',
4
- '1': '121',
5
- '2': '131',
6
- '3': '122',
7
- '4': '132',
8
- '5': '132',
9
- '6': '124',
10
- '7': '111',
11
- '8': '123',
12
- '9': '121',
13
- '10': '133',
14
- '11': '123',
15
- '12': '134',
16
- '13': '134',
17
- '14': '124',
18
- '15': '113',
19
- '16': '114',
20
- '17': '112',
21
- '18': '114',
22
- '19': '131',
23
- '20': '133',
24
- '21': '112',
25
- '22': '122',
26
- '23': '111'
27
- },
28
- eyebrows:{
29
- '0': '121',
30
- '1': '112',
31
- '2': '231',
32
- '3': '212',
33
- '4': '134',
34
- '5': '124',
35
- '6': '111',
36
- '7': '113',
37
- '8': '133',
38
- '9': '122',
39
- '10': '221',
40
- '11': '211',
41
- '12': '131',
42
- '13': '223',
43
- '14': '222',
44
- '15': '213',
45
- '16': '224',
46
- '17': '114',
47
- '18': '214',
48
- '19': '132',
49
- '20': '232',
50
- '21': '123',
51
- '22': '233',
52
- '23': '234'
53
- },
54
- eyes:{
55
- '0': '131',
56
- '1': '113',
57
- '2': '111',
58
- '3': '413',
59
- '4': '121',
60
- '5': '311',
61
- '6': '332',
62
- '7': '411',
63
- '8': '112',
64
- '9': '222',
65
- '10': '414',
66
- '11': '221',
67
- '12': '232',
68
- '13': '331',
69
- '14': '424',
70
- '15': '114',
71
- '16': '133',
72
- '17': '132',
73
- '18': '314',
74
- '19': '231',
75
- '20': '134',
76
- '21': '233',
77
- '22': '433',
78
- '23': '213',
79
- '24': '313',
80
- '25': '214',
81
- '26': '123',
82
- '27': '124',
83
- '28': '324',
84
- '29': '432',
85
- '30': '323',
86
- '31': '333',
87
- '32': '212',
88
- '33': '211',
89
- '34': '223',
90
- '35': '234',
91
- '36': '312',
92
- '37': '322',
93
- '38': '431',
94
- '39': '122',
95
- '40': '224',
96
- '41': '321',
97
- '42': '412',
98
- '43': '423',
99
- '44': '421',
100
- '45': '422',
101
- '46': '334',
102
- '47': '434'
103
- },
104
- hairs:{
105
- '0': '534',
106
- '1': '413',
107
- '2': '632',
108
- '3': '521',
109
- '4': '422',
110
- '5': '433',
111
- '6': '522',
112
- '7': '434',
113
- '8': '414',
114
- '9': '612',
115
- '10': '512',
116
- '11': '513',
117
- '12': '411',
118
- '13': '421',
119
- '14': '511',
120
- '15': '624',
121
- '16': '621',
122
- '17': '533',
123
- '18': '622',
124
- '19': '423',
125
- '20': '532',
126
- '21': '524',
127
- '22': '531',
128
- '23': '312',
129
- '24': '614',
130
- '25': '432',
131
- '26': '412',
132
- '27': '424',
133
- '28': '613',
134
- '29': '634',
135
- '30': '314',
136
- '31': '134',
137
- '32': '211',
138
- '33': '111',
139
- '34': '334',
140
- '35': '514',
141
- '36': '313',
142
- '37': '231',
143
- '38': '321',
144
- '39': '122',
145
- '40': '121',
146
- '41': '323',
147
- '42': '331',
148
- '43': '311',
149
- '44': '112',
150
- '45': '113',
151
- '46': '631',
152
- '47': '221',
153
- '48': '212',
154
- '49': '123',
155
- '50': '223',
156
- '51': '131',
157
- '52': '232',
158
- '53': '623',
159
- '54': '332',
160
- '55': '233',
161
- '56': '114',
162
- '57': '324',
163
- '58': '213',
164
- '59': '133',
165
- '60': '224',
166
- '61': '611',
167
- '62': '234',
168
- '63': '523',
169
- '64': '214',
170
- '65': '333',
171
- '66': '222',
172
- '67': '322',
173
- '68': '124',
174
- '69': '431',
175
- '70': '132',
176
- '71': '633'
177
- }
178
- };
179
- var types2={};
180
- var mappings=[
181
- 11,21,31,
182
- 12,22,32,
183
- 13,23,33,
184
- 14,24,34];
185
- Object.keys(types).forEach(key=>{
186
- types2[key]={};
187
- Object.keys(types[key]).forEach(num=>{
188
- types2[key][num]=mappings.indexOf(+(types[key][num].slice(1,3)));
189
-
190
- });
191
- });
192
- require("fs").writeFileSync("./out.txt",JSON.stringify(types2,0,4));
193
-
194
-
195
- /*
196
- How it should be
197
- 0, 1, 2
198
- 3, 4, 5
199
- 6, 7, 8
200
- 9,10,11
201
-
202
- How it is
203
- 11,21,31,
204
- 12,22,32,
205
- 13,23,33,
206
- 14,24,34
207
- */
208
-