charinfo-ex 0.0.4 → 0.0.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.0.5] - 2026-04-10
4
+
5
+ - Add reading support for ShareMii .ltd files that probably works
6
+
7
+
3
8
  ## [0.0.4] - 2026-04-10
4
9
 
5
10
  - Add the color array and color order data.
@@ -65,6 +65,14 @@ var CharInfoEx = class _CharInfoEx {
65
65
  data.setUint16(offset + i * 2, codeUnit, littleEndian);
66
66
  }
67
67
  }
68
+ static FromShareMiiFileArrayBuffer(saveBuffer) {
69
+ var data = new DataView(saveBuffer);
70
+ let offset = 5;
71
+ const len = data.getUint32(offset, true);
72
+ offset += 4;
73
+ const charInfo = _CharInfoEx.FromArrayBuffer(saveBuffer.slice(offset, offset + len));
74
+ return charInfo;
75
+ }
68
76
  static FromSaveFileArrayBuffer(saveBuffer, index = void 0) {
69
77
  var infoExHash = 2283577978;
70
78
  var data = new DataView(saveBuffer);
package/lib/cjs/index.js CHANGED
@@ -193,6 +193,14 @@ var CharInfoEx = class _CharInfoEx {
193
193
  data.setUint16(offset + i * 2, codeUnit, littleEndian);
194
194
  }
195
195
  }
196
+ static FromShareMiiFileArrayBuffer(saveBuffer) {
197
+ var data = new DataView(saveBuffer);
198
+ let offset = 5;
199
+ const len = data.getUint32(offset, true);
200
+ offset += 4;
201
+ const charInfo = _CharInfoEx.FromArrayBuffer(saveBuffer.slice(offset, offset + len));
202
+ return charInfo;
203
+ }
196
204
  static FromSaveFileArrayBuffer(saveBuffer, index = void 0) {
197
205
  var infoExHash = 2283577978;
198
206
  var data = new DataView(saveBuffer);
@@ -39,6 +39,14 @@ var CharInfoEx = class _CharInfoEx {
39
39
  data.setUint16(offset + i * 2, codeUnit, littleEndian);
40
40
  }
41
41
  }
42
+ static FromShareMiiFileArrayBuffer(saveBuffer) {
43
+ var data = new DataView(saveBuffer);
44
+ let offset = 5;
45
+ const len = data.getUint32(offset, true);
46
+ offset += 4;
47
+ const charInfo = _CharInfoEx.FromArrayBuffer(saveBuffer.slice(offset, offset + len));
48
+ return charInfo;
49
+ }
42
50
  static FromSaveFileArrayBuffer(saveBuffer, index = void 0) {
43
51
  var infoExHash = 2283577978;
44
52
  var data = new DataView(saveBuffer);
package/lib/esm/index.mjs CHANGED
@@ -162,6 +162,14 @@ var CharInfoEx = class _CharInfoEx {
162
162
  data.setUint16(offset + i * 2, codeUnit, littleEndian);
163
163
  }
164
164
  }
165
+ static FromShareMiiFileArrayBuffer(saveBuffer) {
166
+ var data = new DataView(saveBuffer);
167
+ let offset = 5;
168
+ const len = data.getUint32(offset, true);
169
+ offset += 4;
170
+ const charInfo = _CharInfoEx.FromArrayBuffer(saveBuffer.slice(offset, offset + len));
171
+ return charInfo;
172
+ }
165
173
  static FromSaveFileArrayBuffer(saveBuffer, index = void 0) {
166
174
  var infoExHash = 2283577978;
167
175
  var data = new DataView(saveBuffer);
@@ -1,8 +1,9 @@
1
- declare class CharInfoEx {
1
+ export declare class CharInfoEx {
2
2
  constructor();
3
3
  private static bytesToUuidV4;
4
4
  private static uuidV4ToBytes;
5
5
  private static writeStringUTF16Fixed;
6
+ static FromShareMiiFileArrayBuffer(saveBuffer: ArrayBufferLike): CharInfoEx;
6
7
  static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike): CharInfoEx[];
7
8
  static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike, index: number): CharInfoEx;
8
9
  static FromSaveFileArrayBuffer(saveBuffer: ArrayBufferLike, indexes: number[]): CharInfoEx[];
@@ -129,5 +130,3 @@ declare class CharInfoEx {
129
130
  moleY: number;
130
131
  unkDefault45: number;
131
132
  }
132
-
133
- export { CharInfoEx };
@@ -1,4 +1,4 @@
1
- declare enum CharInfoOffset {
1
+ export declare enum CharInfoOffset {
2
2
  createId1 = 0,//s32
3
3
  createId2 = 4,//s32
4
4
  createId3 = 8,//s32
@@ -118,5 +118,3 @@ declare enum CharInfoOffset {
118
118
  moleY = 150,// u8
119
119
  unkDefault45 = 151
120
120
  }
121
-
122
- export { CharInfoOffset };
@@ -0,0 +1,7 @@
1
+ export type MiiColor = Record<number, {
2
+ r: number;
3
+ g: number;
4
+ b: number;
5
+ color: string;
6
+ }>;
7
+ export declare const ColorIndex: MiiColor;
@@ -0,0 +1,2 @@
1
+ export declare const ColorOrderMiiStudio: number[];
2
+ export declare const ColorOrderLTD: number[];
@@ -0,0 +1 @@
1
+ export declare function getStringUTF16NullTerminated(data: DataView, offset: number, maxChars: number, littleEndian?: boolean): string;
@@ -0,0 +1,5 @@
1
+ export { CharInfoEx } from "./CharInfoEx";
2
+ export { CharInfoOffset } from "./CharInfoOffset";
3
+ export { getStringUTF16NullTerminated } from "./Helpers";
4
+ export { ColorIndex, MiiColor } from "./ColorIndex";
5
+ export { ColorOrderLTD, ColorOrderMiiStudio } from "./ColorOrder";
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "charinfo-ex",
3
- "version": "0.0.4",
3
+ "version": "0.0.5",
4
4
  "description": "Package for reading and writing Tomodachi Life character data",
5
- "main": "./lib/cjs/index.js",
6
- "module": "./lib/esm/index.mjs",
7
- "types": "./lib/cjs/index.d.ts",
5
+ "main": "./lib/cjs/index.js",
6
+ "module": "./lib/esm/index.mjs",
7
+ "types": "./lib/types/index.d.ts",
8
8
  "files": [
9
9
  "lib/**",
10
10
  "README.md",
@@ -12,44 +12,46 @@
12
12
  "CHANGELOG.md"
13
13
  ],
14
14
  "exports": {
15
- ".": {
16
- "types": "./lib/cjs/index.d.ts",
17
- "import": "./lib/esm/index.mjs",
18
- "require": "./lib/cjs/index.js"
19
- },
20
- "./CharInfoEx": {
21
- "types": "./lib/cjs/CharInfoEx.d.ts",
22
- "import": "./lib/esm/CharInfoEx.mjs",
23
- "require": "./lib/cjs/CharInfoEx.js"
24
- },
25
- "./CharInfoOffset": {
26
- "types": "./lib/cjs/CharInfoOffset.d.ts",
27
- "import": "./lib/esm/CharInfoOffset.mjs",
28
- "require": "./lib/cjs/CharInfoOffset.js"
29
- },
30
- "./ColorIndex": {
31
- "types": "./lib/cjs/ColorIndex.d.ts",
32
- "import": "./lib/esm/ColorIndex.mjs",
33
- "require": "./lib/cjs/ColorIndex.js"
34
- },
35
- "./ColorOrder": {
36
- "types": "./lib/cjs/ColorOrder.d.ts",
37
- "import": "./lib/esm/ColorOrder.mjs",
38
- "require": "./lib/cjs/ColorOrder.js"
39
- },
40
- "./Helpers": {
41
- "types": "./lib/cjs/Helpers.d.ts",
42
- "import": "./lib/esm/Helpers.mjs",
43
- "require": "./lib/cjs/Helpers.js"
44
- },
15
+ ".": {
16
+ "types": "./lib/types/index.d.ts",
17
+ "import": "./lib/esm/index.mjs",
18
+ "require": "./lib/cjs/index.js"
19
+ },
20
+ "./CharInfoEx": {
21
+ "types": "./lib/types/CharInfoEx.d.ts",
22
+ "import": "./lib/esm/CharInfoEx.mjs",
23
+ "require": "./lib/cjs/CharInfoEx.js"
24
+ },
25
+ "./CharInfoOffset": {
26
+ "types": "./lib/types/CharInfoOffset.d.ts",
27
+ "import": "./lib/esm/CharInfoOffset.mjs",
28
+ "require": "./lib/cjs/CharInfoOffset.js"
29
+ },
30
+ "./ColorIndex": {
31
+ "types": "./lib/types/ColorIndex.d.ts",
32
+ "import": "./lib/esm/ColorIndex.mjs",
33
+ "require": "./lib/cjs/ColorIndex.js"
34
+ },
35
+ "./ColorOrder": {
36
+ "types": "./lib/types/ColorOrder.d.ts",
37
+ "import": "./lib/esm/ColorOrder.mjs",
38
+ "require": "./lib/cjs/ColorOrder.js"
39
+ },
40
+ "./Helpers": {
41
+ "types": "./lib/types/Helpers.d.ts",
42
+ "import": "./lib/esm/Helpers.mjs",
43
+ "require": "./lib/cjs/Helpers.js"
44
+ },
45
45
  "./package.json": "./package.json"
46
46
  },
47
- "scripts": {
48
- "build": "npm run build:esm && npm run build:cjs",
49
- "build:esm": "tsup src/*.ts --format esm --outDir lib/esm --clean --splitting false",
50
- "build:cjs": "tsup src/*.ts --format cjs --dts --outDir lib/cjs --clean",
47
+ "scripts": {
48
+ "build": "npm run build:esm && npm run build:cjs && npm run build:types",
49
+ "build:esm": "tsup src/*.ts --format esm --outDir lib/esm --clean --splitting false",
50
+ "build:cjs": "tsup src/*.ts --format cjs --outDir lib/cjs --clean",
51
+ "build:types": "tsc --emitDeclarationOnly --declaration --declarationMap false --outDir lib/types --rootDir src",
51
52
  "test": "npm run test-read && npm run test-json",
52
53
  "test-read": "tsx ./test/testread.ts ./test/mii.sav ./test/mii.json",
54
+ "test-sharemii": "tsx ./test/testsharemii.ts ./test/mii.ltd",
53
55
  "test-json": "tsx ./test/testwrite.ts ./test/mii.json"
54
56
  },
55
57
  "author": "McSpazzy",
@@ -1,9 +0,0 @@
1
- type MiiColor = Record<number, {
2
- r: number;
3
- g: number;
4
- b: number;
5
- color: string;
6
- }>;
7
- declare const ColorIndex: MiiColor;
8
-
9
- export { ColorIndex, type MiiColor };
@@ -1,4 +0,0 @@
1
- declare const ColorOrderMiiStudio: number[];
2
- declare const ColorOrderLTD: number[];
3
-
4
- export { ColorOrderLTD, ColorOrderMiiStudio };
@@ -1,3 +0,0 @@
1
- declare function getStringUTF16NullTerminated(data: DataView, offset: number, maxChars: number, littleEndian?: boolean): string;
2
-
3
- export { getStringUTF16NullTerminated };
@@ -1,5 +0,0 @@
1
- export { CharInfoEx } from './CharInfoEx.js';
2
- export { CharInfoOffset } from './CharInfoOffset.js';
3
- export { getStringUTF16NullTerminated } from './Helpers.js';
4
- export { ColorIndex, MiiColor } from './ColorIndex.js';
5
- export { ColorOrderLTD, ColorOrderMiiStudio } from './ColorOrder.js';