silphscope 1.2.18 → 1.2.20
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 +1 -1
- package/rom-configs/firered.js +1 -0
- package/src/graphics/extract.js +3 -1
- package/src/graphics/mons/render-mon-foot.js +4 -3
- package/src/graphics/mons/render-mons.js +1 -1
- package/src/graphics/mons/resolvers/mon-footprint-sprite-resolver.js +10 -0
- package/src/graphics/mons/resolvers/mon-icon-palette-resolver.js +1 -0
- package/src/graphics/mons/resolvers/mon-icon-resolver.js +1 -0
package/package.json
CHANGED
package/rom-configs/firered.js
CHANGED
package/src/graphics/extract.js
CHANGED
|
@@ -18,7 +18,9 @@ export function extract(asset, rom) {
|
|
|
18
18
|
console.warn(`lz77 failed for ${asset.name}... treating as raw :p`);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
if (!asset.size) {
|
|
22
|
+
throw new Error(`Attempted to read ${asset.name} however it is missing a size attribute`);
|
|
23
|
+
}
|
|
22
24
|
const slice = rom.slice(start, start + asset.size);
|
|
23
25
|
return { ...asset, data: slice, compressed: false };
|
|
24
26
|
}
|
|
@@ -5,6 +5,7 @@ import { PNG } from "pngjs";
|
|
|
5
5
|
import { extract } from "../extract.js";
|
|
6
6
|
import { decode1bppTile } from "../decode-1bpp.js";
|
|
7
7
|
import fs from "fs";
|
|
8
|
+
import { resolveMonFootprint } from "./resolvers/mon-footprint-sprite-resolver.js";
|
|
8
9
|
|
|
9
10
|
const streamToBuffer = (stream) => new Promise((resolve, reject) => {
|
|
10
11
|
const chunks = [];
|
|
@@ -13,7 +14,7 @@ const streamToBuffer = (stream) => new Promise((resolve, reject) => {
|
|
|
13
14
|
stream.on("error", reject);
|
|
14
15
|
});
|
|
15
16
|
|
|
16
|
-
export async function renderMonFoot(monName, mons,
|
|
17
|
+
export async function renderMonFoot(monName, mons, reader, rom, options = {}) {
|
|
17
18
|
const { outputDir = null } = options;
|
|
18
19
|
|
|
19
20
|
if (!rom || !(rom instanceof Uint8Array || Buffer.isBuffer(rom))) {
|
|
@@ -25,9 +26,9 @@ export async function renderMonFoot(monName, mons, assets, rom, options = {}) {
|
|
|
25
26
|
throw new Error(`Missing mon entry for ${monName}`);
|
|
26
27
|
}
|
|
27
28
|
|
|
28
|
-
if (
|
|
29
|
+
if (monName.includes("UNOWN")) return;
|
|
29
30
|
|
|
30
|
-
const footAsset =
|
|
31
|
+
const footAsset = resolveMonFootprint(mon, reader); // possibly the easiest change ive had to do if it works first try :o
|
|
31
32
|
if (!footAsset) {
|
|
32
33
|
throw new Error(`Missing foot asset for ${monName}`);
|
|
33
34
|
}
|
|
@@ -34,7 +34,7 @@ export async function renderMon(monName, mons, assets, reader, rom, options = {}
|
|
|
34
34
|
await renderMonIcon(monName, mons, reader, rom, { outputDir });
|
|
35
35
|
}
|
|
36
36
|
if (footprint === true) {
|
|
37
|
-
await renderMonFoot(monName, mons,
|
|
37
|
+
await renderMonFoot(monName, mons, reader, rom, { outputDir });
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
const mon = mons[monName];
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function resolveMonFootprint(mon, reader) {
|
|
2
|
+
const table = reader.getTable("monFootprintTable");
|
|
3
|
+
const entryOffset = table + mon.index * 4;
|
|
4
|
+
const ptr = reader.readPointer(entryOffset);
|
|
5
|
+
return {
|
|
6
|
+
name: `mon_${mon.name}_footprint`,
|
|
7
|
+
offset: ptr,
|
|
8
|
+
size: 32,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
@@ -5,6 +5,7 @@ export function resolveMonIconPalette(mon, reader) { // I kinda think this might
|
|
|
5
5
|
const entryOffset = paletteTable + paletteIndex * 8;
|
|
6
6
|
const palettePtr = reader.readPointer(entryOffset);
|
|
7
7
|
return {
|
|
8
|
+
name: `mon_${mon.name}_icon_palette`,
|
|
8
9
|
offset: palettePtr,
|
|
9
10
|
size: 32,
|
|
10
11
|
};
|