charinfo-ex 0.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.
@@ -0,0 +1,134 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CharInfoOffset = void 0;
4
+ var CharInfoOffset;
5
+ (function (CharInfoOffset) {
6
+ CharInfoOffset[CharInfoOffset["createId1"] = 0] = "createId1";
7
+ CharInfoOffset[CharInfoOffset["createId2"] = 4] = "createId2";
8
+ CharInfoOffset[CharInfoOffset["createId3"] = 8] = "createId3";
9
+ CharInfoOffset[CharInfoOffset["createId4"] = 12] = "createId4";
10
+ CharInfoOffset[CharInfoOffset["name"] = 16] = "name";
11
+ CharInfoOffset[CharInfoOffset["fontRegion"] = 38] = "fontRegion";
12
+ CharInfoOffset[CharInfoOffset["gender"] = 39] = "gender";
13
+ CharInfoOffset[CharInfoOffset["height"] = 40] = "height";
14
+ CharInfoOffset[CharInfoOffset["build"] = 41] = "build";
15
+ CharInfoOffset[CharInfoOffset["regionMove"] = 42] = "regionMove";
16
+ // Bit 0 - Unknown
17
+ // Bit 1 - Bangs Side
18
+ // Bit 2 - Back Dual Color
19
+ // Bit 3 - Bangs Dual Color
20
+ // Bit 4 - Eye Shadow Enabled
21
+ // Bit 5 - Mouth Invert?
22
+ // Bit 6 - Moustache Inverted
23
+ // Bit 7 - Mole
24
+ CharInfoOffset[CharInfoOffset["faceFlags"] = 43] = "faceFlags";
25
+ CharInfoOffset[CharInfoOffset["facelineType"] = 44] = "facelineType";
26
+ CharInfoOffset[CharInfoOffset["facelineColor"] = 45] = "facelineColor";
27
+ CharInfoOffset[CharInfoOffset["wrinkleLower"] = 46] = "wrinkleLower";
28
+ CharInfoOffset[CharInfoOffset["wrinkleLowerScale"] = 47] = "wrinkleLowerScale";
29
+ CharInfoOffset[CharInfoOffset["wrinkleLowerAspect"] = 48] = "wrinkleLowerAspect";
30
+ CharInfoOffset[CharInfoOffset["wrinkleLowerX"] = 49] = "wrinkleLowerX";
31
+ CharInfoOffset[CharInfoOffset["wrinkleLowerY"] = 50] = "wrinkleLowerY";
32
+ CharInfoOffset[CharInfoOffset["wrinkleUpper"] = 51] = "wrinkleUpper";
33
+ CharInfoOffset[CharInfoOffset["wrinkleUpperScale"] = 52] = "wrinkleUpperScale";
34
+ CharInfoOffset[CharInfoOffset["wrinkleUpperAspect"] = 53] = "wrinkleUpperAspect";
35
+ CharInfoOffset[CharInfoOffset["wrinkleUpperX"] = 54] = "wrinkleUpperX";
36
+ CharInfoOffset[CharInfoOffset["wrinkleUpperY"] = 55] = "wrinkleUpperY";
37
+ CharInfoOffset[CharInfoOffset["makeup0"] = 56] = "makeup0";
38
+ CharInfoOffset[CharInfoOffset["makeup0Color"] = 57] = "makeup0Color";
39
+ CharInfoOffset[CharInfoOffset["makeup0Scale"] = 58] = "makeup0Scale";
40
+ CharInfoOffset[CharInfoOffset["makeup0Aspect"] = 59] = "makeup0Aspect";
41
+ CharInfoOffset[CharInfoOffset["makeup0X"] = 60] = "makeup0X";
42
+ CharInfoOffset[CharInfoOffset["makeup0Y"] = 61] = "makeup0Y";
43
+ CharInfoOffset[CharInfoOffset["makeup1"] = 62] = "makeup1";
44
+ CharInfoOffset[CharInfoOffset["makeup1Color"] = 63] = "makeup1Color";
45
+ CharInfoOffset[CharInfoOffset["makeup1Scale"] = 64] = "makeup1Scale";
46
+ CharInfoOffset[CharInfoOffset["makeup1Aspect"] = 65] = "makeup1Aspect";
47
+ CharInfoOffset[CharInfoOffset["makeup1X"] = 66] = "makeup1X";
48
+ CharInfoOffset[CharInfoOffset["makeup1Y"] = 67] = "makeup1Y";
49
+ CharInfoOffset[CharInfoOffset["hairType"] = 68] = "hairType";
50
+ CharInfoOffset[CharInfoOffset["hairColor0"] = 70] = "hairColor0";
51
+ CharInfoOffset[CharInfoOffset["hairColor1"] = 71] = "hairColor1";
52
+ CharInfoOffset[CharInfoOffset["hairTypeFront"] = 72] = "hairTypeFront";
53
+ CharInfoOffset[CharInfoOffset["hairTypeBack"] = 73] = "hairTypeBack";
54
+ // Bit 0 - Left Side
55
+ // Bit 1 - Right Side
56
+ CharInfoOffset[CharInfoOffset["hairStyle"] = 74] = "hairStyle";
57
+ CharInfoOffset[CharInfoOffset["earType"] = 75] = "earType";
58
+ CharInfoOffset[CharInfoOffset["earScale"] = 76] = "earScale";
59
+ CharInfoOffset[CharInfoOffset["earY"] = 77] = "earY";
60
+ CharInfoOffset[CharInfoOffset["eyeType"] = 78] = "eyeType";
61
+ CharInfoOffset[CharInfoOffset["eyeColor"] = 79] = "eyeColor";
62
+ CharInfoOffset[CharInfoOffset["eyeScale"] = 80] = "eyeScale";
63
+ CharInfoOffset[CharInfoOffset["eyeAspect"] = 81] = "eyeAspect";
64
+ CharInfoOffset[CharInfoOffset["eyeRotate"] = 82] = "eyeRotate";
65
+ CharInfoOffset[CharInfoOffset["eyeX"] = 83] = "eyeX";
66
+ CharInfoOffset[CharInfoOffset["eyeY"] = 84] = "eyeY";
67
+ CharInfoOffset[CharInfoOffset["eyeShadowColor"] = 85] = "eyeShadowColor";
68
+ CharInfoOffset[CharInfoOffset["eyeHighlightType"] = 86] = "eyeHighlightType";
69
+ CharInfoOffset[CharInfoOffset["eyeHighlightScale"] = 87] = "eyeHighlightScale";
70
+ CharInfoOffset[CharInfoOffset["eyeHighlightAspect"] = 88] = "eyeHighlightAspect";
71
+ CharInfoOffset[CharInfoOffset["eyeHighlightRotate"] = 89] = "eyeHighlightRotate";
72
+ CharInfoOffset[CharInfoOffset["eyeHighlightX"] = 90] = "eyeHighlightX";
73
+ CharInfoOffset[CharInfoOffset["eyeHighlightY"] = 91] = "eyeHighlightY";
74
+ CharInfoOffset[CharInfoOffset["eyelashUpperType"] = 92] = "eyelashUpperType";
75
+ CharInfoOffset[CharInfoOffset["eyelashUpperScale"] = 93] = "eyelashUpperScale";
76
+ CharInfoOffset[CharInfoOffset["eyelashUpperAspect"] = 94] = "eyelashUpperAspect";
77
+ CharInfoOffset[CharInfoOffset["eyelashUpperRotate"] = 95] = "eyelashUpperRotate";
78
+ CharInfoOffset[CharInfoOffset["eyelashUpperX"] = 96] = "eyelashUpperX";
79
+ CharInfoOffset[CharInfoOffset["eyelashUpperY"] = 97] = "eyelashUpperY";
80
+ CharInfoOffset[CharInfoOffset["eyelashLowerType"] = 98] = "eyelashLowerType";
81
+ CharInfoOffset[CharInfoOffset["eyelashLowerScale"] = 99] = "eyelashLowerScale";
82
+ CharInfoOffset[CharInfoOffset["eyelashLowerAspect"] = 100] = "eyelashLowerAspect";
83
+ CharInfoOffset[CharInfoOffset["eyelashLowerRotate"] = 101] = "eyelashLowerRotate";
84
+ CharInfoOffset[CharInfoOffset["eyelashLowerX"] = 102] = "eyelashLowerX";
85
+ CharInfoOffset[CharInfoOffset["eyelashLowerY"] = 103] = "eyelashLowerY";
86
+ CharInfoOffset[CharInfoOffset["eyeLidUpperType"] = 104] = "eyeLidUpperType";
87
+ CharInfoOffset[CharInfoOffset["eyeLidUpperScale"] = 105] = "eyeLidUpperScale";
88
+ CharInfoOffset[CharInfoOffset["eyeLidUpperAspect"] = 106] = "eyeLidUpperAspect";
89
+ CharInfoOffset[CharInfoOffset["eyeLidUpperRotate"] = 107] = "eyeLidUpperRotate";
90
+ CharInfoOffset[CharInfoOffset["eyeLidUpperX"] = 108] = "eyeLidUpperX";
91
+ CharInfoOffset[CharInfoOffset["eyeLidUpperY"] = 109] = "eyeLidUpperY";
92
+ CharInfoOffset[CharInfoOffset["eyelidLowerType"] = 110] = "eyelidLowerType";
93
+ CharInfoOffset[CharInfoOffset["eyelidLowerScale"] = 111] = "eyelidLowerScale";
94
+ CharInfoOffset[CharInfoOffset["eyelidLowerAspect"] = 112] = "eyelidLowerAspect";
95
+ CharInfoOffset[CharInfoOffset["eyelidLowerRotate"] = 113] = "eyelidLowerRotate";
96
+ CharInfoOffset[CharInfoOffset["eyelidLowerX"] = 114] = "eyelidLowerX";
97
+ CharInfoOffset[CharInfoOffset["eyelidLowerY"] = 115] = "eyelidLowerY";
98
+ CharInfoOffset[CharInfoOffset["eyebrowType"] = 116] = "eyebrowType";
99
+ CharInfoOffset[CharInfoOffset["eyebrowColor"] = 117] = "eyebrowColor";
100
+ CharInfoOffset[CharInfoOffset["eyebrowScale"] = 118] = "eyebrowScale";
101
+ CharInfoOffset[CharInfoOffset["eyebrowAspect"] = 119] = "eyebrowAspect";
102
+ CharInfoOffset[CharInfoOffset["eyebrowRotate"] = 120] = "eyebrowRotate";
103
+ CharInfoOffset[CharInfoOffset["eyebrowX"] = 121] = "eyebrowX";
104
+ CharInfoOffset[CharInfoOffset["eyebrowY"] = 122] = "eyebrowY";
105
+ CharInfoOffset[CharInfoOffset["noseType"] = 123] = "noseType";
106
+ CharInfoOffset[CharInfoOffset["noseScale"] = 124] = "noseScale";
107
+ CharInfoOffset[CharInfoOffset["noseY"] = 125] = "noseY";
108
+ CharInfoOffset[CharInfoOffset["mouthType"] = 126] = "mouthType";
109
+ CharInfoOffset[CharInfoOffset["mouthColor"] = 127] = "mouthColor";
110
+ CharInfoOffset[CharInfoOffset["mouthScale"] = 128] = "mouthScale";
111
+ CharInfoOffset[CharInfoOffset["mouthAspect"] = 129] = "mouthAspect";
112
+ CharInfoOffset[CharInfoOffset["mouthRotate"] = 130] = "mouthRotate";
113
+ CharInfoOffset[CharInfoOffset["mouthY"] = 131] = "mouthY";
114
+ CharInfoOffset[CharInfoOffset["beardType"] = 132] = "beardType";
115
+ CharInfoOffset[CharInfoOffset["beardColor"] = 133] = "beardColor";
116
+ CharInfoOffset[CharInfoOffset["beardShortType"] = 134] = "beardShortType";
117
+ CharInfoOffset[CharInfoOffset["beardShortColor"] = 135] = "beardShortColor";
118
+ CharInfoOffset[CharInfoOffset["mustacheType"] = 136] = "mustacheType";
119
+ CharInfoOffset[CharInfoOffset["mustacheColor"] = 137] = "mustacheColor";
120
+ CharInfoOffset[CharInfoOffset["mustacheScale"] = 138] = "mustacheScale";
121
+ CharInfoOffset[CharInfoOffset["mustacheAspect"] = 139] = "mustacheAspect";
122
+ CharInfoOffset[CharInfoOffset["mustacheY"] = 140] = "mustacheY";
123
+ CharInfoOffset[CharInfoOffset["glassType1"] = 141] = "glassType1";
124
+ CharInfoOffset[CharInfoOffset["glassColor1"] = 142] = "glassColor1";
125
+ CharInfoOffset[CharInfoOffset["glassScale"] = 143] = "glassScale";
126
+ CharInfoOffset[CharInfoOffset["glassAspect"] = 144] = "glassAspect";
127
+ CharInfoOffset[CharInfoOffset["glassY"] = 145] = "glassY";
128
+ CharInfoOffset[CharInfoOffset["glassType2"] = 146] = "glassType2";
129
+ CharInfoOffset[CharInfoOffset["glassColor2"] = 147] = "glassColor2";
130
+ CharInfoOffset[CharInfoOffset["moleScale"] = 148] = "moleScale";
131
+ CharInfoOffset[CharInfoOffset["moleX"] = 149] = "moleX";
132
+ CharInfoOffset[CharInfoOffset["moleY"] = 150] = "moleY";
133
+ CharInfoOffset[CharInfoOffset["unkDefault45"] = 151] = "unkDefault45";
134
+ })(CharInfoOffset || (exports.CharInfoOffset = CharInfoOffset = {}));
@@ -0,0 +1 @@
1
+ export declare function getStringUTF16NullTerminated(data: DataView, offset: number, maxChars: number, littleEndian?: boolean): string;
package/lib/Helpers.js ADDED
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStringUTF16NullTerminated = getStringUTF16NullTerminated;
4
+ function getStringUTF16NullTerminated(data, offset, maxChars, littleEndian = true) {
5
+ const chars = [];
6
+ for (let i = 0; i < maxChars; i++) {
7
+ const codeUnit = data.getUint16(offset, littleEndian);
8
+ offset += 2;
9
+ if (codeUnit === 0) {
10
+ offset += (maxChars - i - 1) * 2;
11
+ break;
12
+ }
13
+ chars.push(codeUnit);
14
+ }
15
+ return String.fromCharCode(...chars);
16
+ }
package/lib/index.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ export { CharInfoEx } from "./CharInfoEx";
2
+ export { CharInfoOffset } from "./CharInfoOffset";
3
+ export { getStringUTF16NullTerminated } from "./Helpers";
package/lib/index.js ADDED
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getStringUTF16NullTerminated = exports.CharInfoOffset = exports.CharInfoEx = void 0;
4
+ var CharInfoEx_1 = require("./CharInfoEx");
5
+ Object.defineProperty(exports, "CharInfoEx", { enumerable: true, get: function () { return CharInfoEx_1.CharInfoEx; } });
6
+ var CharInfoOffset_1 = require("./CharInfoOffset");
7
+ Object.defineProperty(exports, "CharInfoOffset", { enumerable: true, get: function () { return CharInfoOffset_1.CharInfoOffset; } });
8
+ var Helpers_1 = require("./Helpers");
9
+ Object.defineProperty(exports, "getStringUTF16NullTerminated", { enumerable: true, get: function () { return Helpers_1.getStringUTF16NullTerminated; } });
@@ -0,0 +1,140 @@
1
+ // By Arian and SuperSpazzy
2
+
3
+ #pragma endian little
4
+
5
+ bitfield FaceFlags {
6
+ unknown : 1;
7
+ bangsSide : 1;
8
+ backDualColor : 1;
9
+ bangsDualColor : 1;
10
+ eyeShadowEnabled : 1;
11
+ mouthInvert : 1;
12
+ mustacheInverted : 1;
13
+ moleHigh : 1;
14
+ };
15
+
16
+ bitfield HairStyleFlags {
17
+ leftSide : 1;
18
+ rightSide : 1;
19
+ reserved : 6;
20
+ };
21
+
22
+ struct CharInfoEx {
23
+ u8 uuidv4[16];
24
+ char16 name[11];
25
+ u8 fontRegion;
26
+ u8 gender;
27
+ u8 height;
28
+ u8 build;
29
+ u8 regionMove;
30
+ FaceFlags faceFlags;
31
+ u8 facelineType;
32
+ u8 facelineColor;
33
+ u8 wrinkle0;
34
+ u8 wrinkle0Scale;
35
+ u8 wrinkle0Aspect;
36
+ u8 wrinkle0X;
37
+ u8 wrinkle0Y;
38
+ u8 wrinkle1;
39
+ u8 wrinkle1Scale;
40
+ u8 wrinkle1Aspect;
41
+ u8 wrinkle1X;
42
+ u8 wrinkle1Y;
43
+ u8 makeup0;
44
+ u8 makeup0Color;
45
+ u8 makeup0Scale;
46
+ u8 makeup0Aspect;
47
+ u8 makeup0X;
48
+ u8 makeup0Y;
49
+ u8 makeup1;
50
+ u8 makeup1Color;
51
+ u8 makeup1Scale;
52
+ u8 makeup1Aspect;
53
+ u8 makeup1X;
54
+ u8 makeup1Y;
55
+ u16 hairType;
56
+ u8 hairColor0;
57
+ u8 hairColor1;
58
+ u8 hairTypeFront;
59
+ u8 hairTypeBack;
60
+ HairStyleFlags hairStyle;
61
+ u8 earType;
62
+ u8 earScale;
63
+ u8 earY;
64
+ u8 eyeType;
65
+ u8 eyeColor;
66
+ u8 eyeScale;
67
+ u8 eyeAspect;
68
+ u8 eyeRotate;
69
+ u8 eyeX;
70
+ u8 eyeY;
71
+ u8 eyeShadowColor;
72
+ u8 eyePupilType;
73
+ u8 eyePupilScale;
74
+ u8 eyePupilAspect;
75
+ u8 eyePupilRotate;
76
+ u8 eyePupilX;
77
+ u8 eyePupilY;
78
+ u8 eyelashUpperType;
79
+ u8 eyelashUpperScale;
80
+ u8 eyelashUpperAspect;
81
+ u8 eyelashUpperRotate;
82
+ u8 eyelashUpperX;
83
+ u8 eyelashUpperY;
84
+ u8 eyelashLowerType;
85
+ u8 eyelashLowerScale;
86
+ u8 eyelashLowerAspect;
87
+ u8 eyelashLowerRotate;
88
+ u8 eyelashLowerX;
89
+ u8 eyelashLowerY;
90
+ u8 eyeStrokeUpperType;
91
+ u8 eyeStrokeUpperScale;
92
+ u8 eyeStrokeUpperAspect;
93
+ u8 eyeStrokeUpperRotate;
94
+ u8 eyeStrokeUpperX;
95
+ u8 eyeStrokeUpperY;
96
+ u8 eyeStrokeLowerType;
97
+ u8 eyeStrokeLowerScale;
98
+ u8 eyeStrokeLowerAspect;
99
+ u8 eyeStrokeLowerRotate;
100
+ u8 eyeStrokeLowerX;
101
+ u8 eyeStrokeLowerY;
102
+ u8 eyebrowType;
103
+ u8 eyebrowColor;
104
+ u8 eyebrowScale;
105
+ u8 eyebrowAspect;
106
+ u8 eyebrowRotate;
107
+ u8 eyebrowX;
108
+ u8 eyebrowY;
109
+ u8 noseType;
110
+ u8 noseScale;
111
+ u8 noseY;
112
+ u8 mouthType;
113
+ u8 mouthColor;
114
+ u8 mouthScale;
115
+ u8 mouthAspect;
116
+ u8 mouthRotate;
117
+ u8 mouthY;
118
+ u8 beardType;
119
+ u8 beardColor;
120
+ u8 stubbleType;
121
+ u8 stubbleColor;
122
+ u8 mustacheType;
123
+ u8 mustacheColor;
124
+ u8 mustacheScale;
125
+ u8 mustacheAspect;
126
+ u8 mustacheY;
127
+ u8 glassType1;
128
+ u8 glassColor1;
129
+ u8 glassScale;
130
+ u8 glassAspect;
131
+ u8 glassY;
132
+ u8 glassType2;
133
+ u8 glassColor2;
134
+ u8 moleScale;
135
+ u8 moleX;
136
+ u8 moleY;
137
+ u8 unkDefault45;
138
+ };
139
+
140
+ CharInfoEx info @ 0x0;
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "charinfo-ex",
3
+ "version": "0.0.1",
4
+ "description": "Package for reading and writing Tomodachi Life character data",
5
+ "main": "./lib/index.js",
6
+ "scripts": {
7
+ "build": "tsc",
8
+ "test-read": "ts-node ./test/testread.ts ./test/mii.sav ./test/mii.json"
9
+ },
10
+ "author": "McSpazzy",
11
+ "license": "MIT",
12
+ "devDependencies": {
13
+ "@types/node": "^20.4.5",
14
+ "ts-node": "^10.9.1",
15
+ "typescript": "^5.1.6"
16
+ },
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "git+https://github.com/McSpazzy/charinfo-ex.git"
20
+ },
21
+ "homepage": "https://github.com/McSpazzy/charinfo-ex",
22
+ "bugs": {
23
+ "url": "https://github.com/McSpazzy/charinfo-ex/issues"
24
+ },
25
+ "dependencies": {
26
+
27
+ }
28
+ }
@@ -0,0 +1,310 @@
1
+ import { CharInfoOffset } from "./CharInfoOffset";
2
+ import { getStringUTF16NullTerminated } from "./Helpers";
3
+ export class CharInfoEx {
4
+ constructor() {}
5
+
6
+ private static bytesToUuidV4(bytes: Uint8Array): string {
7
+ const hex = Array.from(bytes, (b) => b.toString(16).padStart(2, "0")).join("");
8
+ return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20, 32)}`;
9
+ }
10
+
11
+ public static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike): CharInfoEx[];
12
+ public static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike, index: number): CharInfoEx;
13
+ public static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike, indexes: number[]): CharInfoEx[];
14
+ public static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike, index: number | number[] | undefined = undefined): CharInfoEx | CharInfoEx[] {
15
+ var infoExHash = 2283577978;
16
+
17
+ var data = new DataView(saveBuffer);
18
+ var dataOffset = data.getUint32(0x8, true);
19
+ var offset = 0x28;
20
+
21
+ var exPosition = 0;
22
+
23
+ while (offset < dataOffset) {
24
+ var hash = data.getUint32(offset, true);
25
+ offset += 4;
26
+ var currentOffset = data.getUint32(offset, true);
27
+ offset += 4;
28
+ if (hash === infoExHash) {
29
+ exPosition = currentOffset;
30
+ }
31
+ }
32
+
33
+ var entryPositionCount = data.getUint32(exPosition, true);
34
+ exPosition += 4;
35
+
36
+ const charArray: CharInfoEx[] = [];
37
+ for (let index = 0; index < 2; index++) {
38
+ const len = data.getUint32(exPosition, true);
39
+ exPosition += 4;
40
+ const charInfo = CharInfoEx.FromArrayBuffer(saveBuffer.slice(exPosition, exPosition + len));
41
+ exPosition += len;
42
+ charArray.push(charInfo);
43
+ }
44
+
45
+ if (!index) {
46
+ return charArray;
47
+ }
48
+
49
+ if (Array.isArray(index)) {
50
+ return index.map((v) => charArray[v - 1]);
51
+ } else {
52
+ return charArray[index - 1];
53
+ }
54
+ }
55
+
56
+ public static FromArrayLike(arrayLike: Iterable<number>): CharInfoEx {
57
+ var data = Uint8Array.from(arrayLike);
58
+ return CharInfoEx.FromArrayBuffer(data.buffer);
59
+ }
60
+
61
+ public static FromArrayBuffer(buffer: ArrayBufferLike): CharInfoEx {
62
+ const charItem = new CharInfoEx();
63
+ const dataView = new DataView(buffer);
64
+ const u8 = (offset: CharInfoOffset) => dataView.getUint8(offset);
65
+ const u16 = (offset: CharInfoOffset) => dataView.getUint16(offset, true);
66
+ const idBytes = new Uint8Array(buffer, CharInfoOffset.createId1, 16);
67
+
68
+ charItem.uuidv4 = CharInfoEx.bytesToUuidV4(idBytes);
69
+ charItem.name = getStringUTF16NullTerminated(dataView, CharInfoOffset.name, 11);
70
+ charItem.fontRegion = u8(CharInfoOffset.fontRegion);
71
+ charItem.gender = u8(CharInfoOffset.gender);
72
+ charItem.height = u8(CharInfoOffset.height);
73
+ charItem.build = u8(CharInfoOffset.build);
74
+ charItem.regionMove = u8(CharInfoOffset.regionMove);
75
+ charItem.faceFlags = u8(CharInfoOffset.faceFlags);
76
+ charItem.facelineType = u8(CharInfoOffset.facelineType);
77
+ charItem.facelineColor = u8(CharInfoOffset.facelineColor);
78
+ charItem.wrinkleLower = u8(CharInfoOffset.wrinkleLower);
79
+ charItem.wrinkleLowerScale = u8(CharInfoOffset.wrinkleLowerScale);
80
+ charItem.wrinkleLowerAspect = u8(CharInfoOffset.wrinkleLowerAspect);
81
+ charItem.wrinkleLowerX = u8(CharInfoOffset.wrinkleLowerX);
82
+ charItem.wrinkleLowerY = u8(CharInfoOffset.wrinkleLowerY);
83
+ charItem.wrinkleUpper = u8(CharInfoOffset.wrinkleUpper);
84
+ charItem.wrinkleUpperScale = u8(CharInfoOffset.wrinkleUpperScale);
85
+ charItem.wrinkleUpperAspect = u8(CharInfoOffset.wrinkleUpperAspect);
86
+ charItem.wrinkleUpperX = u8(CharInfoOffset.wrinkleUpperX);
87
+ charItem.wrinkleUpperY = u8(CharInfoOffset.wrinkleUpperY);
88
+ charItem.makeup0 = u8(CharInfoOffset.makeup0);
89
+ charItem.makeup0Color = u8(CharInfoOffset.makeup0Color);
90
+ charItem.makeup0Scale = u8(CharInfoOffset.makeup0Scale);
91
+ charItem.makeup0Aspect = u8(CharInfoOffset.makeup0Aspect);
92
+ charItem.makeup0X = u8(CharInfoOffset.makeup0X);
93
+ charItem.makeup0Y = u8(CharInfoOffset.makeup0Y);
94
+ charItem.makeup1 = u8(CharInfoOffset.makeup1);
95
+ charItem.makeup1Color = u8(CharInfoOffset.makeup1Color);
96
+ charItem.makeup1Scale = u8(CharInfoOffset.makeup1Scale);
97
+ charItem.makeup1Aspect = u8(CharInfoOffset.makeup1Aspect);
98
+ charItem.makeup1X = u8(CharInfoOffset.makeup1X);
99
+ charItem.makeup1Y = u8(CharInfoOffset.makeup1Y);
100
+ charItem.hairType = u16(CharInfoOffset.hairType);
101
+ charItem.hairColor0 = u8(CharInfoOffset.hairColor0);
102
+ charItem.hairColor1 = u8(CharInfoOffset.hairColor1);
103
+ charItem.hairTypeFront = u8(CharInfoOffset.hairTypeFront);
104
+ charItem.hairTypeBack = u8(CharInfoOffset.hairTypeBack);
105
+ charItem.hairStyle = u8(CharInfoOffset.hairStyle);
106
+ charItem.earType = u8(CharInfoOffset.earType);
107
+ charItem.earScale = u8(CharInfoOffset.earScale);
108
+ charItem.earY = u8(CharInfoOffset.earY);
109
+ charItem.eyeType = u8(CharInfoOffset.eyeType);
110
+ charItem.eyeColor = u8(CharInfoOffset.eyeColor);
111
+ charItem.eyeScale = u8(CharInfoOffset.eyeScale);
112
+ charItem.eyeAspect = u8(CharInfoOffset.eyeAspect);
113
+ charItem.eyeRotate = u8(CharInfoOffset.eyeRotate);
114
+ charItem.eyeX = u8(CharInfoOffset.eyeX);
115
+ charItem.eyeY = u8(CharInfoOffset.eyeY);
116
+ charItem.eyeShadowColor = u8(CharInfoOffset.eyeShadowColor);
117
+ charItem.eyeHighlightType = u8(CharInfoOffset.eyeHighlightType);
118
+ charItem.eyeHighlightScale = u8(CharInfoOffset.eyeHighlightScale);
119
+ charItem.eyeHighlightAspect = u8(CharInfoOffset.eyeHighlightAspect);
120
+ charItem.eyeHighlightRotate = u8(CharInfoOffset.eyeHighlightRotate);
121
+ charItem.eyeHighlightX = u8(CharInfoOffset.eyeHighlightX);
122
+ charItem.eyeHighlightY = u8(CharInfoOffset.eyeHighlightY);
123
+ charItem.eyelashUpperType = u8(CharInfoOffset.eyelashUpperType);
124
+ charItem.eyelashUpperScale = u8(CharInfoOffset.eyelashUpperScale);
125
+ charItem.eyelashUpperAspect = u8(CharInfoOffset.eyelashUpperAspect);
126
+ charItem.eyelashUpperRotate = u8(CharInfoOffset.eyelashUpperRotate);
127
+ charItem.eyelashUpperX = u8(CharInfoOffset.eyelashUpperX);
128
+ charItem.eyelashUpperY = u8(CharInfoOffset.eyelashUpperY);
129
+ charItem.eyelashLowerType = u8(CharInfoOffset.eyelashLowerType);
130
+ charItem.eyelashLowerScale = u8(CharInfoOffset.eyelashLowerScale);
131
+ charItem.eyelashLowerAspect = u8(CharInfoOffset.eyelashLowerAspect);
132
+ charItem.eyelashLowerRotate = u8(CharInfoOffset.eyelashLowerRotate);
133
+ charItem.eyelashLowerX = u8(CharInfoOffset.eyelashLowerX);
134
+ charItem.eyelashLowerY = u8(CharInfoOffset.eyelashLowerY);
135
+ charItem.eyeLidUpperType = u8(CharInfoOffset.eyeLidUpperType);
136
+ charItem.eyeLidUpperScale = u8(CharInfoOffset.eyeLidUpperScale);
137
+ charItem.eyeLidUpperAspect = u8(CharInfoOffset.eyeLidUpperAspect);
138
+ charItem.eyeLidUpperRotate = u8(CharInfoOffset.eyeLidUpperRotate);
139
+ charItem.eyeLidUpperX = u8(CharInfoOffset.eyeLidUpperX);
140
+ charItem.eyeLidUpperY = u8(CharInfoOffset.eyeLidUpperY);
141
+ charItem.eyelidLowerType = u8(CharInfoOffset.eyelidLowerType);
142
+ charItem.eyelidLowerScale = u8(CharInfoOffset.eyelidLowerScale);
143
+ charItem.eyelidLowerAspect = u8(CharInfoOffset.eyelidLowerAspect);
144
+ charItem.eyelidLowerRotate = u8(CharInfoOffset.eyelidLowerRotate);
145
+ charItem.eyelidLowerX = u8(CharInfoOffset.eyelidLowerX);
146
+ charItem.eyelidLowerY = u8(CharInfoOffset.eyelidLowerY);
147
+ charItem.eyebrowType = u8(CharInfoOffset.eyebrowType);
148
+ charItem.eyebrowColor = u8(CharInfoOffset.eyebrowColor);
149
+ charItem.eyebrowScale = u8(CharInfoOffset.eyebrowScale);
150
+ charItem.eyebrowAspect = u8(CharInfoOffset.eyebrowAspect);
151
+ charItem.eyebrowRotate = u8(CharInfoOffset.eyebrowRotate);
152
+ charItem.eyebrowX = u8(CharInfoOffset.eyebrowX);
153
+ charItem.eyebrowY = u8(CharInfoOffset.eyebrowY);
154
+ charItem.noseType = u8(CharInfoOffset.noseType);
155
+ charItem.noseScale = u8(CharInfoOffset.noseScale);
156
+ charItem.noseY = u8(CharInfoOffset.noseY);
157
+ charItem.mouthType = u8(CharInfoOffset.mouthType);
158
+ charItem.mouthColor = u8(CharInfoOffset.mouthColor);
159
+ charItem.mouthScale = u8(CharInfoOffset.mouthScale);
160
+ charItem.mouthAspect = u8(CharInfoOffset.mouthAspect);
161
+ charItem.mouthRotate = u8(CharInfoOffset.mouthRotate);
162
+ charItem.mouthY = u8(CharInfoOffset.mouthY);
163
+ charItem.beardType = u8(CharInfoOffset.beardType);
164
+ charItem.beardColor = u8(CharInfoOffset.beardColor);
165
+ charItem.beardShortType = u8(CharInfoOffset.beardShortType);
166
+ charItem.beardShortColor = u8(CharInfoOffset.beardShortColor);
167
+ charItem.mustacheType = u8(CharInfoOffset.mustacheType);
168
+ charItem.mustacheColor = u8(CharInfoOffset.mustacheColor);
169
+ charItem.mustacheScale = u8(CharInfoOffset.mustacheScale);
170
+ charItem.mustacheAspect = u8(CharInfoOffset.mustacheAspect);
171
+ charItem.mustacheY = u8(CharInfoOffset.mustacheY);
172
+ charItem.glassType1 = u8(CharInfoOffset.glassType1);
173
+ charItem.glassColor1 = u8(CharInfoOffset.glassColor1);
174
+ charItem.glassScale = u8(CharInfoOffset.glassScale);
175
+ charItem.glassAspect = u8(CharInfoOffset.glassAspect);
176
+ charItem.glassY = u8(CharInfoOffset.glassY);
177
+ charItem.glassType2 = u8(CharInfoOffset.glassType2);
178
+ charItem.glassColor2 = u8(CharInfoOffset.glassColor2);
179
+ charItem.moleScale = u8(CharInfoOffset.moleScale);
180
+ charItem.moleX = u8(CharInfoOffset.moleX);
181
+ charItem.moleY = u8(CharInfoOffset.moleY);
182
+ charItem.unkDefault45 = u8(CharInfoOffset.unkDefault45);
183
+
184
+ return charItem;
185
+ }
186
+
187
+ public toJson(pretty: boolean = true): string {
188
+ if (pretty) {
189
+ return JSON.stringify(this, null, 4);
190
+ } else {
191
+ return JSON.stringify(this);
192
+ }
193
+ }
194
+
195
+ uuidv4: string = "";
196
+ name: string = ""; // utf16 - 11 char
197
+ fontRegion: number = 0;
198
+ gender: number = 0; // u8
199
+ height: number = 0; // u8
200
+ build: number = 0; // u8
201
+ regionMove: number = 0; // u8
202
+ faceFlags: number = 0; // u8
203
+ facelineType: number = 0; // u8
204
+ facelineColor: number = 0; // u8
205
+ wrinkleLower: number = 0; // u8
206
+ wrinkleLowerScale: number = 0; // u8
207
+ wrinkleLowerAspect: number = 0; // u8
208
+ wrinkleLowerX: number = 0; // u8
209
+ wrinkleLowerY: number = 0; // u8
210
+ wrinkleUpper: number = 0; // u8
211
+ wrinkleUpperScale: number = 0; // u8
212
+ wrinkleUpperAspect: number = 0; // u8
213
+ wrinkleUpperX: number = 0; // u8
214
+ wrinkleUpperY: number = 0; // u8
215
+ makeup0: number = 0; // u8
216
+ makeup0Color: number = 0; // u8
217
+ makeup0Scale: number = 0; // u8
218
+ makeup0Aspect: number = 0; // u8
219
+ makeup0X: number = 0; // u8
220
+ makeup0Y: number = 0; // u8
221
+ makeup1: number = 0; // u8
222
+ makeup1Color: number = 0; // u8
223
+ makeup1Scale: number = 0; // u8
224
+ makeup1Aspect: number = 0; // u8
225
+ makeup1X: number = 0; // u8
226
+ makeup1Y: number = 0; // u8
227
+ hairType: number = 0; // u16
228
+ hairColor0: number = 0; // u8
229
+ hairColor1: number = 0; // u8
230
+ hairTypeFront: number = 0; // u8
231
+ hairTypeBack: number = 0; // u8
232
+ hairStyle: number = 0; // u8
233
+ earType: number = 0; // u8
234
+ earScale: number = 0; // u8
235
+ earY: number = 0; // u8
236
+ eyeType: number = 0; // u8
237
+ eyeColor: number = 0; // u8
238
+ eyeScale: number = 0; // u8
239
+ eyeAspect: number = 0; // u8
240
+ eyeRotate: number = 0; // u8
241
+ eyeX: number = 0; // u8
242
+ eyeY: number = 0; // u8
243
+ eyeShadowColor: number = 0; // u8
244
+ eyeHighlightType: number = 0; // u8
245
+ eyeHighlightScale: number = 0; // u8
246
+ eyeHighlightAspect: number = 0; // u8
247
+ eyeHighlightRotate: number = 0; // u8
248
+ eyeHighlightX: number = 0; // u8
249
+ eyeHighlightY: number = 0; // u8
250
+ eyelashUpperType: number = 0; // u8
251
+ eyelashUpperScale: number = 0; // u8
252
+ eyelashUpperAspect: number = 0; // u8
253
+ eyelashUpperRotate: number = 0; // u8
254
+ eyelashUpperX: number = 0; // u8
255
+ eyelashUpperY: number = 0; // u8
256
+ eyelashLowerType: number = 0; // u8
257
+ eyelashLowerScale: number = 0; // u8
258
+ eyelashLowerAspect: number = 0; // u8
259
+ eyelashLowerRotate: number = 0; // u8
260
+ eyelashLowerX: number = 0; // u8
261
+ eyelashLowerY: number = 0; // u8
262
+ eyeLidUpperType: number = 0; // u8
263
+ eyeLidUpperScale: number = 0; // u8
264
+ eyeLidUpperAspect: number = 0; // u8
265
+ eyeLidUpperRotate: number = 0; // u8
266
+ eyeLidUpperX: number = 0; // u8
267
+ eyeLidUpperY: number = 0; // u8
268
+ eyelidLowerType: number = 0; // u8
269
+ eyelidLowerScale: number = 0; // u8
270
+ eyelidLowerAspect: number = 0; // u8
271
+ eyelidLowerRotate: number = 0; // u8
272
+ eyelidLowerX: number = 0; // u8
273
+ eyelidLowerY: number = 0; // u8
274
+ eyebrowType: number = 0; // u8
275
+ eyebrowColor: number = 0; // u8
276
+ eyebrowScale: number = 0; // u8
277
+ eyebrowAspect: number = 0; // u8
278
+ eyebrowRotate: number = 0; // u8
279
+ eyebrowX: number = 0; // u8
280
+ eyebrowY: number = 0; // u8
281
+ noseType: number = 0; // u8
282
+ noseScale: number = 0; // u8
283
+ noseY: number = 0; // u8
284
+ mouthType: number = 0; // u8
285
+ mouthColor: number = 0; // u8
286
+ mouthScale: number = 0; // u8
287
+ mouthAspect: number = 0; // u8
288
+ mouthRotate: number = 0; // u8
289
+ mouthY: number = 0; // u8
290
+ beardType: number = 0; // u8
291
+ beardColor: number = 0; // u8
292
+ beardShortType: number = 0; // u8
293
+ beardShortColor: number = 0; // u8
294
+ mustacheType: number = 0; // u8
295
+ mustacheColor: number = 0; // u8
296
+ mustacheScale: number = 0; // u8
297
+ mustacheAspect: number = 0; // u8
298
+ mustacheY: number = 0; // u8
299
+ glassType1: number = 0; // u8
300
+ glassColor1: number = 0; // u8
301
+ glassScale: number = 0; // u8
302
+ glassAspect: number = 0; // u8
303
+ glassY: number = 0; // u8
304
+ glassType2: number = 0; // u8
305
+ glassColor2: number = 0; // u8
306
+ moleScale: number = 0; // u8
307
+ moleX: number = 0; // u8
308
+ moleY: number = 0; // u8
309
+ unkDefault45: number = 0; // u8
310
+ }