silphscope 1.0.0 → 1.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "silphscope",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "A firered/leafgreen ROM asset extractor for use in web applications",
5
5
  "main": "main.js",
6
6
  "exports": {
@@ -16,9 +16,13 @@
16
16
  "mon-data/",
17
17
  "rom-maps/"
18
18
  ],
19
+ "scripts": {
20
+ "test": "echo \"Error: no test specified\" && exit 1"
21
+ },
19
22
  "keywords": [],
20
23
  "author": "chickenPoo",
21
24
  "license": "MIT",
25
+ "packageManager": "pnpm@10.17.1",
22
26
  "type": "module",
23
27
  "dependencies": {
24
28
  "pngjs": "^7.0.0"
@@ -26,8 +30,5 @@
26
30
  "repository": {
27
31
  "type": "git",
28
32
  "url": "https://github.com/chickenpoo351/SilphScope.git"
29
- },
30
- "scripts": {
31
- "test": "echo \"Error: no test specified\" && exit 1"
32
33
  }
33
- }
34
+ }
@@ -72,16 +72,26 @@ export async function renderMonIcon(monName, mons, assets, iconPalettes, rom, op
72
72
  }
73
73
  }
74
74
 
75
- const png = new PNG({ width, height });
76
- png.data = image;
77
- const pngBuffer = await streamToBuffer(png.pack());
75
+ const frameHeight = 32;
76
+ const frameSize = width * frameHeight * 4;
77
+ const frame1 = image.slice(0, frameSize);
78
+ const frame2 = image.slice(frameSize, frameSize * 2);
79
+ const pngFrame1 = new PNG({ width, height: frameHeight });
80
+ pngFrame1.data = frame1;
81
+ const pngFrame2 = new PNG({ width, height: frameHeight });
82
+ pngFrame2.data = frame2;
83
+ const buffer1 = await streamToBuffer(pngFrame1.pack());
84
+ const buffer2 = await streamToBuffer(pngFrame2.pack());
78
85
 
79
86
  if (outputDir) {
80
87
  const dir = `${outputDir}/${monName}`;
81
88
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
82
- const fileName = `${dir}/icon.png`;
83
- fs.writeFileSync(fileName, pngBuffer);
89
+ fs.writeFileSync(`${dir}/icon_frame1.png`, buffer1);
90
+ fs.writeFileSync(`${dir}/icon_frame2.png`, buffer2);
84
91
  }
85
92
 
86
- return pngBuffer;
93
+ return {
94
+ frame1: buffer1,
95
+ frame2: buffer2,
96
+ };
87
97
  }