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/README.md +2 -1
- package/defaultMii.json +188 -0
- package/fflWrapper.js +41 -0
- package/index.js +157 -271
- package/package.json +6 -3
- package/patch-ffl.js +48 -0
- package/out.txt +0 -178
- package/stuff.js +0 -208
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).
|
package/defaultMii.json
ADDED
|
@@ -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/fflWrapper.js
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
// Compatibility layer for ffl.js
|
|
2
|
+
const structFu = require('struct-fu');
|
|
3
|
+
|
|
4
|
+
// Monkey-patch struct-fu BEFORE ffl.js loads
|
|
5
|
+
const originalStruct = structFu.struct;
|
|
6
|
+
structFu.struct = function(...args) {
|
|
7
|
+
const result = originalStruct.apply(this, args);
|
|
8
|
+
const originalUnpack = result.unpack;
|
|
9
|
+
const originalPack = result.pack;
|
|
10
|
+
|
|
11
|
+
result.unpack = function(data) {
|
|
12
|
+
if (data && !(data instanceof Buffer) && data.buffer) {
|
|
13
|
+
data = Buffer.from(data);
|
|
14
|
+
}
|
|
15
|
+
return originalUnpack.call(this, data);
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
result.pack = function(obj) {
|
|
19
|
+
if (obj && typeof obj === 'object') {
|
|
20
|
+
for (let key in obj) {
|
|
21
|
+
if (key.startsWith('_padding') && Array.isArray(obj[key])) {
|
|
22
|
+
obj[key] = Buffer.from(obj[key]);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
return originalPack.call(this, obj);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
// Set up globals
|
|
33
|
+
global._ = structFu;
|
|
34
|
+
global.THREE = require('three');
|
|
35
|
+
|
|
36
|
+
// Load ffl.js - it will use the patched struct-fu
|
|
37
|
+
const fflPath = require.resolve('ffl.js/ffl.js');
|
|
38
|
+
delete require.cache[fflPath]; // Clear cache
|
|
39
|
+
const fflModule = require('ffl.js/ffl.js');
|
|
40
|
+
|
|
41
|
+
module.exports = fflModule;
|