silphscope 1.4.21 → 1.4.23
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 +185 -83
- package/docs/node/renderAllBalls.md +0 -0
- package/docs/node/renderAllGraphics.md +0 -0
- package/docs/node/renderAllIcons.md +0 -0
- package/docs/node/renderAllMons.md +0 -0
- package/docs/node/renderAllMoves.md +0 -0
- package/docs/node/renderAllTrainers.md +0 -0
- package/docs/node/renderAllX-options.md +0 -0
- package/item-data/itemData.json +376 -1128
- package/main.js +149 -5
- package/mon-data/monData.json +440 -4373
- package/move-data/moveData.json +0 -609
- package/package.json +3 -2
- package/silphscope.d.ts +579 -502
- package/src/graphics/balls/render-ball-particle.js +48 -26
- package/src/graphics/balls/render-balls.js +45 -22
- package/src/graphics/graphics-extractor-main.js +155 -294
- package/src/graphics/icons/render-icons.js +14 -4
- package/src/graphics/mons/render-mon-foot.js +17 -5
- package/src/graphics/mons/render-mon-icon.js +27 -6
- package/src/graphics/mons/render-mons.js +16 -7
- package/src/graphics/moves/render-moves.js +44 -29
- package/src/graphics/trainers/render-trainer-back-pics.js +52 -10
- package/src/graphics/trainers/render-trainers.js +16 -19
- package/src/is-valid-filter-type.js +15 -0
- package/src/run-with-concurrency.js +12 -0
- package/src/validate-render-options.js +28 -0
- package/trainer-data/trainerData.json +148 -444
package/silphscope.d.ts
CHANGED
|
@@ -1,13 +1,32 @@
|
|
|
1
|
-
|
|
1
|
+
import { RomReader } from "./src/rom-reader.js";
|
|
2
|
+
|
|
3
|
+
// this file is getting messy... or well at least to me :p
|
|
4
|
+
// I wonder if it is possible to make multiple .d.ts files and import them into a main one...
|
|
5
|
+
// I mean apparently .js file imports work so I don't see why that wouldn't...
|
|
6
|
+
// but oh well I already have this going may as well stick with it until I get tired of it
|
|
7
|
+
// and refactor :o
|
|
8
|
+
|
|
9
|
+
export interface RenderedAsset<Meta> {
|
|
10
|
+
name: string;
|
|
11
|
+
category: string;
|
|
12
|
+
asset: string;
|
|
13
|
+
path: string;
|
|
14
|
+
buffer: Buffer;
|
|
15
|
+
meta: Meta;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type RomData = Uint8Array | Buffer;
|
|
19
|
+
|
|
20
|
+
export type PngFilterType =
|
|
2
21
|
| -1
|
|
3
22
|
| 0
|
|
4
23
|
| 1
|
|
5
24
|
| 2
|
|
6
25
|
| 3
|
|
7
26
|
| 4
|
|
8
|
-
| Array<0 | 1 | 2 | 3 | 4
|
|
27
|
+
| Array<0 | 1 | 2 | 3 | 4>;
|
|
9
28
|
|
|
10
|
-
export interface
|
|
29
|
+
export interface RenderGenericOptions {
|
|
11
30
|
/**
|
|
12
31
|
* Directory to write extracted assets to.
|
|
13
32
|
*
|
|
@@ -17,18 +36,6 @@ export interface RenderAllMonsOptions {
|
|
|
17
36
|
* @default "./out"
|
|
18
37
|
*/
|
|
19
38
|
outputDir?: string | null;
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Number of concurrent render operations.
|
|
23
|
-
*
|
|
24
|
-
* Increase with caution. Values that are too high may reduce
|
|
25
|
-
* performance depending on available CPU and disk resources.
|
|
26
|
-
*
|
|
27
|
-
* Set to `1` to render sequentially.
|
|
28
|
-
*
|
|
29
|
-
* @default 4
|
|
30
|
-
*/
|
|
31
|
-
concurrency?: number;
|
|
32
39
|
|
|
33
40
|
/**
|
|
34
41
|
* PNG filter mode used during encoding.
|
|
@@ -73,6 +80,19 @@ export interface RenderAllMonsOptions {
|
|
|
73
80
|
*/
|
|
74
81
|
pngCompressionLevel?: number;
|
|
75
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Return generated image buffers instead of only writing
|
|
85
|
+
* files to disk.
|
|
86
|
+
*
|
|
87
|
+
* Useful for web servers, editors, bots, and other tools
|
|
88
|
+
* that need direct access to rendered assets.
|
|
89
|
+
*
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
returnFileBuffer?: boolean;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface RenderAllGenericOptions extends RenderGenericOptions {
|
|
76
96
|
/**
|
|
77
97
|
* Print progress information as assets are rendered.
|
|
78
98
|
*
|
|
@@ -90,16 +110,19 @@ export interface RenderAllMonsOptions {
|
|
|
90
110
|
showSummary?: boolean;
|
|
91
111
|
|
|
92
112
|
/**
|
|
93
|
-
*
|
|
94
|
-
* files to disk.
|
|
113
|
+
* Number of concurrent render operations.
|
|
95
114
|
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
115
|
+
* Increase with caution. Values that are too high may reduce
|
|
116
|
+
* performance depending on available CPU and disk resources.
|
|
98
117
|
*
|
|
99
|
-
*
|
|
118
|
+
* Set to `1` to render sequentially.
|
|
119
|
+
*
|
|
120
|
+
* @default 4
|
|
100
121
|
*/
|
|
101
|
-
|
|
122
|
+
concurrency?: number;
|
|
123
|
+
}
|
|
102
124
|
|
|
125
|
+
export interface RenderAllMonsOptions extends RenderAllGenericOptions {
|
|
103
126
|
/**
|
|
104
127
|
* Render mon icon graphics.
|
|
105
128
|
*
|
|
@@ -115,14 +138,109 @@ export interface RenderAllMonsOptions {
|
|
|
115
138
|
footprint?: boolean;
|
|
116
139
|
}
|
|
117
140
|
|
|
118
|
-
export
|
|
141
|
+
export type MonSide = "front" | "back";
|
|
142
|
+
export type MonVariant = "normal" | "shiny";
|
|
143
|
+
|
|
144
|
+
export interface RenderMonOptions extends RenderGenericOptions {
|
|
145
|
+
/**
|
|
146
|
+
* Render mon icon graphics.
|
|
147
|
+
*
|
|
148
|
+
* @default true
|
|
149
|
+
*/
|
|
150
|
+
icon?: boolean;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Render mon footprint graphics.
|
|
154
|
+
*
|
|
155
|
+
* @default true
|
|
156
|
+
*/
|
|
157
|
+
footprint?: boolean;
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Render mon side specific graphics.
|
|
161
|
+
*
|
|
162
|
+
* Takes either a single string or an array with two strings.
|
|
163
|
+
*
|
|
164
|
+
* @default ["front","back"]
|
|
165
|
+
*/
|
|
166
|
+
side?: MonSide | MonSide[];
|
|
167
|
+
|
|
168
|
+
/**
|
|
169
|
+
* Render mon variant specific graphics.
|
|
170
|
+
*
|
|
171
|
+
* Takes either a single string or an array with two strings.
|
|
172
|
+
*
|
|
173
|
+
* @default ["normal","shiny"]
|
|
174
|
+
*/
|
|
175
|
+
variant?: MonVariant | MonVariant[];
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export interface RenderMonIconOptions extends RenderGenericOptions {
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export interface RenderMonFootOptions extends RenderGenericOptions {
|
|
183
|
+
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
export interface MonSpriteMeta {
|
|
187
|
+
side: "front" | "back";
|
|
188
|
+
variant: "normal" | "shiny";
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export interface MonIconMeta {
|
|
192
|
+
frame: 1 | 2;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface MonFootprintMeta {
|
|
196
|
+
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
export type RenderAllMonsBufferResult =
|
|
200
|
+
| (RenderedAsset<MonSpriteMeta> & {
|
|
201
|
+
category: "mon";
|
|
202
|
+
asset: "sprite";
|
|
203
|
+
})
|
|
204
|
+
| (RenderedAsset<MonIconMeta> & {
|
|
205
|
+
category: "mon";
|
|
206
|
+
asset: "icon";
|
|
207
|
+
})
|
|
208
|
+
| (RenderedAsset<MonFootprintMeta> & {
|
|
209
|
+
category: "mon";
|
|
210
|
+
asset: "footprint";
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
export interface RenderAllResult {
|
|
119
214
|
totalFileCount: number;
|
|
120
215
|
}
|
|
121
216
|
|
|
122
|
-
export interface
|
|
123
|
-
finalResults:
|
|
217
|
+
export interface RenderAllResultWithBuffers<T> extends RenderAllResult {
|
|
218
|
+
finalResults: T[];
|
|
124
219
|
}
|
|
125
220
|
|
|
221
|
+
export type RenderMonBufferResult = RenderAllMonsBufferResult;
|
|
222
|
+
|
|
223
|
+
export type RenderMonIconBufferResult =
|
|
224
|
+
(RenderedAsset<MonIconMeta>);
|
|
225
|
+
|
|
226
|
+
export type RenderMonFootBufferResult =
|
|
227
|
+
(RenderedAsset<MonFootprintMeta>);
|
|
228
|
+
|
|
229
|
+
export interface RenderResult {
|
|
230
|
+
fullFileCount: number;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface RenderResultWithBuffers<T> extends RenderResult {
|
|
234
|
+
results: T[];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
export interface ObjectDataEntry {
|
|
238
|
+
index: number;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export type MonData =
|
|
242
|
+
Record<string, ObjectDataEntry>;
|
|
243
|
+
|
|
126
244
|
/**
|
|
127
245
|
* Extracts and renders all mon graphics from a Firered/Leafgreen ROM.
|
|
128
246
|
*
|
|
@@ -132,119 +250,122 @@ export interface RenderResultWithBuffers extends RenderResult {
|
|
|
132
250
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
133
251
|
*/
|
|
134
252
|
export function renderAllMons(
|
|
135
|
-
rom:
|
|
253
|
+
rom: RomData,
|
|
136
254
|
options?: RenderAllMonsOptions & {
|
|
137
255
|
returnFileBuffer: true;
|
|
138
256
|
}
|
|
139
|
-
): Promise<
|
|
257
|
+
): Promise<RenderAllResultWithBuffers<RenderAllMonsBufferResult>>;
|
|
258
|
+
|
|
259
|
+
export function renderAllMons(
|
|
260
|
+
rom: RomData,
|
|
261
|
+
options?: RenderAllMonsOptions
|
|
262
|
+
): Promise<RenderAllResult>;
|
|
140
263
|
|
|
141
264
|
/**
|
|
142
|
-
* Extracts and renders
|
|
265
|
+
* Extracts and renders the graphics for a single mon from a Firered/Leafgreen ROM.
|
|
143
266
|
*
|
|
144
|
-
*
|
|
267
|
+
* Capable of handling the front/back normal/shiny body sprites, footprint, and icon graphics of any single mon.
|
|
145
268
|
*
|
|
269
|
+
* @param monName Name of the mon to render.
|
|
270
|
+
* @param mons Mapping of mons to their index values.
|
|
271
|
+
* @param reader RomReader used for pointer resolution.
|
|
146
272
|
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
147
273
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
148
|
-
*/
|
|
149
|
-
export function
|
|
150
|
-
|
|
151
|
-
|
|
274
|
+
*/
|
|
275
|
+
export function renderMon(
|
|
276
|
+
monName: string,
|
|
277
|
+
mons: MonData,
|
|
278
|
+
reader: RomReader,
|
|
279
|
+
rom: RomData,
|
|
280
|
+
options?: RenderMonOptions & {
|
|
281
|
+
returnFileBuffer: true,
|
|
282
|
+
}
|
|
283
|
+
): Promise<RenderResultWithBuffers<RenderMonBufferResult>>;
|
|
284
|
+
|
|
285
|
+
export function renderMon(
|
|
286
|
+
monName: string,
|
|
287
|
+
mons: MonData,
|
|
288
|
+
reader: RomReader,
|
|
289
|
+
rom: RomData,
|
|
290
|
+
options?: RenderMonOptions,
|
|
152
291
|
): Promise<RenderResult>;
|
|
153
292
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
293
|
+
/**
|
|
294
|
+
* Extracts and renders the icon graphic of a mon from a Firered/Leafgreen ROM.
|
|
295
|
+
*
|
|
296
|
+
* @param monName Name of the mon to render.
|
|
297
|
+
* @param mons Mapping of mons to their index values.
|
|
298
|
+
* @param reader RomReader used for pointer resolution.
|
|
299
|
+
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
300
|
+
* @param options Optional configuration for rendering behaviour and other options.
|
|
301
|
+
*/
|
|
302
|
+
export function renderMonIcon(
|
|
303
|
+
monName: string,
|
|
304
|
+
mons: MonData,
|
|
305
|
+
reader: RomReader,
|
|
306
|
+
rom: RomData,
|
|
307
|
+
options?: RenderMonIconOptions & {
|
|
308
|
+
returnFileBuffer: true,
|
|
309
|
+
}
|
|
310
|
+
): Promise<RenderResultWithBuffers<RenderMonIconBufferResult>>;
|
|
311
|
+
|
|
312
|
+
export function renderMonIcon(
|
|
313
|
+
monName: string,
|
|
314
|
+
mons: MonData,
|
|
315
|
+
reader: RomReader,
|
|
316
|
+
rom: RomData,
|
|
317
|
+
options?: RenderMonIconOptions,
|
|
318
|
+
): Promise<RenderResult>;
|
|
164
319
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
320
|
+
/**
|
|
321
|
+
* Extracts and renders the footprint graphic of a mon from a Firered/Leafgreen ROM.
|
|
322
|
+
*
|
|
323
|
+
* @param monName Name of the mon footprint to render.
|
|
324
|
+
* @param mons Mapping of mons to their index values.
|
|
325
|
+
* @param reader RomReader used for pointer resolution.
|
|
326
|
+
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
327
|
+
* @param options Optional configuration for rendering behaviour and other options.
|
|
328
|
+
*/
|
|
329
|
+
export function renderMonFoot(
|
|
330
|
+
monName: string,
|
|
331
|
+
mons: MonData,
|
|
332
|
+
reader: RomReader,
|
|
333
|
+
rom: RomData,
|
|
334
|
+
options?: RenderMonFootOptions & {
|
|
335
|
+
returnFileBuffer: true,
|
|
336
|
+
}
|
|
337
|
+
): Promise<RenderResultWithBuffers<RenderMonFootBufferResult>>;
|
|
338
|
+
|
|
339
|
+
export function renderMonFoot(
|
|
340
|
+
monName: string,
|
|
341
|
+
mons: MonData,
|
|
342
|
+
reader: RomReader,
|
|
343
|
+
rom: RomData,
|
|
344
|
+
options?: RenderMonFootOptions
|
|
345
|
+
): Promise<RenderResult>;
|
|
176
346
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
* Accepts a value between `-1` and `4`:
|
|
181
|
-
*
|
|
182
|
-
* - `-1` = Automatically determine the best filter
|
|
183
|
-
* - `0` = None
|
|
184
|
-
* - `1` = Sub
|
|
185
|
-
* - `2` = Up
|
|
186
|
-
* - `3` = Average
|
|
187
|
-
* - `4` = Paeth
|
|
188
|
-
*
|
|
189
|
-
* Arrays may also be supplied. When an array is provided,
|
|
190
|
-
* SilphScope tests only the specified filters and selects
|
|
191
|
-
* the smallest resulting PNG.
|
|
192
|
-
*
|
|
193
|
-
* Examples:
|
|
194
|
-
*
|
|
195
|
-
* ```js
|
|
196
|
-
* pngFilterType: 0
|
|
197
|
-
* pngFilterType: -1
|
|
198
|
-
* pngFilterType: [1, 3, 4]
|
|
199
|
-
* ```
|
|
200
|
-
*
|
|
201
|
-
* @default 0
|
|
202
|
-
*/
|
|
203
|
-
pngFilterType?: PngFilterType;
|
|
347
|
+
export interface RenderAllIconsOptions extends RenderAllGenericOptions {
|
|
348
|
+
// welp thats funny I guess this one has no unique options...
|
|
349
|
+
}
|
|
204
350
|
|
|
205
|
-
|
|
206
|
-
* PNG compression level.
|
|
207
|
-
*
|
|
208
|
-
* Accepts a value between `0` and `9`.
|
|
209
|
-
*
|
|
210
|
-
* Higher values generally produce smaller files at the cost
|
|
211
|
-
* of additional processing time.
|
|
212
|
-
*
|
|
213
|
-
* - `0` = No compression
|
|
214
|
-
* - `9` = Maximum compression
|
|
215
|
-
*
|
|
216
|
-
* @default 4
|
|
217
|
-
*/
|
|
218
|
-
pngCompressionLevel?: number;
|
|
351
|
+
export interface RenderIconOptions extends RenderGenericOptions {
|
|
219
352
|
|
|
220
|
-
|
|
221
|
-
* Print progress information as assets are rendered.
|
|
222
|
-
*
|
|
223
|
-
* @default true
|
|
224
|
-
*/
|
|
225
|
-
verboseLogs?: boolean;
|
|
353
|
+
}
|
|
226
354
|
|
|
227
|
-
|
|
228
|
-
* Print a summary after rendering completes.
|
|
229
|
-
*
|
|
230
|
-
* Includes render count, file count, and elapsed time.
|
|
231
|
-
*
|
|
232
|
-
* @default true
|
|
233
|
-
*/
|
|
234
|
-
showSummary?: boolean;
|
|
355
|
+
export interface IconSpriteMeta {
|
|
235
356
|
|
|
236
|
-
/**
|
|
237
|
-
* Return generated image buffers instead of only writing
|
|
238
|
-
* files to disk.
|
|
239
|
-
*
|
|
240
|
-
* Useful for web servers, editors, bots, and other tools
|
|
241
|
-
* that need direct access to rendered assets.
|
|
242
|
-
*
|
|
243
|
-
* @default false
|
|
244
|
-
*/
|
|
245
|
-
returnFileBuffer?: boolean;
|
|
246
357
|
}
|
|
247
358
|
|
|
359
|
+
export type RenderAllIconsBufferResult =
|
|
360
|
+
| (RenderedAsset<IconSpriteMeta> & {
|
|
361
|
+
category: "icon";
|
|
362
|
+
asset: "sprite";
|
|
363
|
+
});
|
|
364
|
+
|
|
365
|
+
export type RenderIconBufferResult = RenderAllIconsBufferResult;
|
|
366
|
+
|
|
367
|
+
export type IconData = Record<string, ObjectDataEntry>;
|
|
368
|
+
|
|
248
369
|
/**
|
|
249
370
|
* Extracts and renders all icon graphics from a Firered/Leafgreen ROM.
|
|
250
371
|
*
|
|
@@ -254,126 +375,95 @@ export interface RenderAllIconsOptions {
|
|
|
254
375
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
255
376
|
*/
|
|
256
377
|
export function renderAllIcons(
|
|
257
|
-
rom:
|
|
378
|
+
rom: RomData,
|
|
258
379
|
options?: RenderAllIconsOptions & {
|
|
259
380
|
returnFileBuffer: true;
|
|
260
381
|
}
|
|
261
|
-
): Promise<
|
|
382
|
+
): Promise<RenderAllResultWithBuffers<RenderAllIconsBufferResult>>;
|
|
383
|
+
|
|
384
|
+
export function renderAllIcons(
|
|
385
|
+
rom: RomData,
|
|
386
|
+
options?: RenderAllIconsOptions
|
|
387
|
+
): Promise<RenderAllResult>;
|
|
262
388
|
|
|
263
389
|
/**
|
|
264
|
-
* Extracts and renders
|
|
265
|
-
*
|
|
266
|
-
* Handles only icon graphics.
|
|
390
|
+
* Extracts and renders a item icon graphic from a Firered/Leafgreen ROM.
|
|
267
391
|
*
|
|
392
|
+
* @param itemName Name of the item icon to render.
|
|
393
|
+
* @param items Mapping of item icons to their index values.
|
|
394
|
+
* @param reader RomReader used for pointer resolution.
|
|
268
395
|
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
269
396
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
270
397
|
*/
|
|
271
|
-
export function
|
|
272
|
-
|
|
273
|
-
|
|
398
|
+
export function renderIcon(
|
|
399
|
+
itemName: string,
|
|
400
|
+
items: IconData,
|
|
401
|
+
reader: RomReader,
|
|
402
|
+
rom: RomData,
|
|
403
|
+
options?: RenderIconOptions & {
|
|
404
|
+
returnFileBuffer: true,
|
|
405
|
+
}
|
|
406
|
+
): Promise<RenderResultWithBuffers<RenderIconBufferResult>>;
|
|
407
|
+
|
|
408
|
+
export function renderIcon(
|
|
409
|
+
itemName: string,
|
|
410
|
+
items: IconData,
|
|
411
|
+
reader: RomReader,
|
|
412
|
+
rom: RomData,
|
|
413
|
+
options?: RenderIconOptions
|
|
274
414
|
): Promise<RenderResult>;
|
|
275
415
|
|
|
276
|
-
export interface RenderAllTrainersOptions {
|
|
416
|
+
export interface RenderAllTrainersOptions extends RenderAllGenericOptions {
|
|
277
417
|
/**
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
* consumed directly from memory without being written to disk.
|
|
282
|
-
*
|
|
283
|
-
* @default "./out"
|
|
418
|
+
* Render trainer back graphics.
|
|
419
|
+
*
|
|
420
|
+
* @default true
|
|
284
421
|
*/
|
|
285
|
-
|
|
422
|
+
trainerBackPics?: boolean;
|
|
423
|
+
}
|
|
286
424
|
|
|
425
|
+
export interface RenderTrainerOptions extends RenderGenericOptions {
|
|
287
426
|
/**
|
|
288
|
-
*
|
|
289
|
-
*
|
|
290
|
-
*
|
|
291
|
-
* performance depending on available CPU and disk resources.
|
|
292
|
-
*
|
|
293
|
-
* Set to `1` to render sequentially.
|
|
294
|
-
*
|
|
295
|
-
* @default 4
|
|
427
|
+
* Render trainer back graphics.
|
|
428
|
+
*
|
|
429
|
+
* @default true
|
|
296
430
|
*/
|
|
297
|
-
|
|
431
|
+
trainerBackPics?: boolean;
|
|
432
|
+
}
|
|
298
433
|
|
|
299
|
-
|
|
300
|
-
* PNG filter mode used during encoding.
|
|
301
|
-
*
|
|
302
|
-
* Accepts a value between `-1` and `4`:
|
|
303
|
-
*
|
|
304
|
-
* - `-1` = Automatically determine the best filter
|
|
305
|
-
* - `0` = None
|
|
306
|
-
* - `1` = Sub
|
|
307
|
-
* - `2` = Up
|
|
308
|
-
* - `3` = Average
|
|
309
|
-
* - `4` = Paeth
|
|
310
|
-
*
|
|
311
|
-
* Arrays may also be supplied. When an array is provided,
|
|
312
|
-
* SilphScope tests only the specified filters and selects
|
|
313
|
-
* the smallest resulting PNG.
|
|
314
|
-
*
|
|
315
|
-
* Examples:
|
|
316
|
-
*
|
|
317
|
-
* ```js
|
|
318
|
-
* pngFilterType: 0
|
|
319
|
-
* pngFilterType: -1
|
|
320
|
-
* pngFilterType: [1, 3, 4]
|
|
321
|
-
* ```
|
|
322
|
-
*
|
|
323
|
-
* @default 0
|
|
324
|
-
*/
|
|
325
|
-
pngFilterType?: PngFilterType;
|
|
434
|
+
export interface RenderTrainerBackPicOptions extends RenderGenericOptions {
|
|
326
435
|
|
|
327
|
-
|
|
328
|
-
* PNG compression level.
|
|
329
|
-
*
|
|
330
|
-
* Accepts a value between `0` and `9`.
|
|
331
|
-
*
|
|
332
|
-
* Higher values generally produce smaller files at the cost
|
|
333
|
-
* of additional processing time.
|
|
334
|
-
*
|
|
335
|
-
* - `0` = No compression
|
|
336
|
-
* - `9` = Maximum compression
|
|
337
|
-
*
|
|
338
|
-
* @default 4
|
|
339
|
-
*/
|
|
340
|
-
pngCompressionLevel?: number;
|
|
436
|
+
}
|
|
341
437
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
*
|
|
345
|
-
* @default true
|
|
346
|
-
*/
|
|
347
|
-
verboseLogs?: boolean;
|
|
438
|
+
export type TrainerData =
|
|
439
|
+
Record<string, ObjectDataEntry>;
|
|
348
440
|
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
*
|
|
352
|
-
* Includes render count, file count, and elapsed time.
|
|
353
|
-
*
|
|
354
|
-
* @default true
|
|
355
|
-
*/
|
|
356
|
-
showSummary?: boolean;
|
|
441
|
+
export type TrainerBackData =
|
|
442
|
+
Record<string, ObjectDataEntry>;
|
|
357
443
|
|
|
358
|
-
|
|
359
|
-
* Return generated image buffers instead of only writing
|
|
360
|
-
* files to disk.
|
|
361
|
-
*
|
|
362
|
-
* Useful for web servers, editors, bots, and other tools
|
|
363
|
-
* that need direct access to rendered assets.
|
|
364
|
-
*
|
|
365
|
-
* @default false
|
|
366
|
-
*/
|
|
367
|
-
returnFileBuffer?: boolean;
|
|
444
|
+
export interface TrainerFrameMeta {
|
|
368
445
|
|
|
369
|
-
/**
|
|
370
|
-
* Render trainer back graphics.
|
|
371
|
-
*
|
|
372
|
-
* @default true
|
|
373
|
-
*/
|
|
374
|
-
trainerBackPics?: boolean;
|
|
375
446
|
}
|
|
376
447
|
|
|
448
|
+
export interface TrainerSpriteMeta {
|
|
449
|
+
side: "front" | "back";
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export type RenderAllTrainersBufferResult =
|
|
453
|
+
| (RenderedAsset<TrainerFrameMeta> & {
|
|
454
|
+
category: "trainer";
|
|
455
|
+
asset: "frame";
|
|
456
|
+
})
|
|
457
|
+
| (RenderedAsset<TrainerSpriteMeta> & {
|
|
458
|
+
category: "trainer";
|
|
459
|
+
asset: "sprite";
|
|
460
|
+
});
|
|
461
|
+
|
|
462
|
+
export type RenderTrainerBufferResult = RenderAllTrainersBufferResult;
|
|
463
|
+
|
|
464
|
+
export type RenderTrainerBackPicBufferResult =
|
|
465
|
+
(RenderedAsset<TrainerFrameMeta>);
|
|
466
|
+
|
|
377
467
|
/**
|
|
378
468
|
* Extracts and renders all trainer graphics from a Firered/Leafgreen ROM.
|
|
379
469
|
*
|
|
@@ -383,118 +473,103 @@ export interface RenderAllTrainersOptions {
|
|
|
383
473
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
384
474
|
*/
|
|
385
475
|
export function renderAllTrainers(
|
|
386
|
-
rom:
|
|
476
|
+
rom: RomData,
|
|
387
477
|
options?: RenderAllTrainersOptions & {
|
|
388
478
|
returnFileBuffer: true;
|
|
389
479
|
}
|
|
390
|
-
): Promise<
|
|
480
|
+
): Promise<RenderAllResultWithBuffers<RenderAllTrainersBufferResult>>;
|
|
481
|
+
|
|
482
|
+
export function renderAllTrainers(
|
|
483
|
+
rom: RomData,
|
|
484
|
+
options?: RenderAllTrainersOptions
|
|
485
|
+
): Promise<RenderAllResult>;
|
|
391
486
|
|
|
392
487
|
/**
|
|
393
|
-
* Extracts and renders
|
|
394
|
-
*
|
|
395
|
-
* Handles trainer front and back graphics.
|
|
488
|
+
* Extracts and renders a single trainer's graphic from a Firered/Leafgreen ROM.
|
|
396
489
|
*
|
|
490
|
+
* @param trainerName Name of the trainer to render.
|
|
491
|
+
* @param trainers Mapping of trainers to their index values.
|
|
492
|
+
* @param backtrainers Mapping of trainers back graphics to their index values.
|
|
493
|
+
* @param reader RomReader used for pointer resolution.
|
|
397
494
|
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
398
495
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
399
496
|
*/
|
|
400
|
-
export function
|
|
401
|
-
|
|
402
|
-
|
|
497
|
+
export function renderTrainer(
|
|
498
|
+
trainerName: string,
|
|
499
|
+
trainers: TrainerData,
|
|
500
|
+
backTrainers: TrainerBackData,
|
|
501
|
+
reader: RomReader,
|
|
502
|
+
rom: RomData,
|
|
503
|
+
options?: RenderTrainerOptions & {
|
|
504
|
+
returnFileBuffer: true,
|
|
505
|
+
}
|
|
506
|
+
): Promise<RenderResultWithBuffers<RenderTrainerBufferResult>>;
|
|
507
|
+
|
|
508
|
+
export function renderTrainer(
|
|
509
|
+
trainerName: string,
|
|
510
|
+
trainers: TrainerData,
|
|
511
|
+
backTrainers: TrainerBackData,
|
|
512
|
+
reader: RomReader,
|
|
513
|
+
rom: RomData,
|
|
514
|
+
options?: RenderTrainerOptions
|
|
403
515
|
): Promise<RenderResult>;
|
|
404
516
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
* Accepts a value between `-1` and `4`:
|
|
432
|
-
*
|
|
433
|
-
* - `-1` = Automatically determine the best filter
|
|
434
|
-
* - `0` = None
|
|
435
|
-
* - `1` = Sub
|
|
436
|
-
* - `2` = Up
|
|
437
|
-
* - `3` = Average
|
|
438
|
-
* - `4` = Paeth
|
|
439
|
-
*
|
|
440
|
-
* Arrays may also be supplied. When an array is provided,
|
|
441
|
-
* SilphScope tests only the specified filters and selects
|
|
442
|
-
* the smallest resulting PNG.
|
|
443
|
-
*
|
|
444
|
-
* Examples:
|
|
445
|
-
*
|
|
446
|
-
* ```js
|
|
447
|
-
* pngFilterType: 0
|
|
448
|
-
* pngFilterType: -1
|
|
449
|
-
* pngFilterType: [1, 3, 4]
|
|
450
|
-
* ```
|
|
451
|
-
*
|
|
452
|
-
* @default 0
|
|
453
|
-
*/
|
|
454
|
-
pngFilterType?: PngFilterType;
|
|
455
|
-
|
|
456
|
-
/**
|
|
457
|
-
* PNG compression level.
|
|
458
|
-
*
|
|
459
|
-
* Accepts a value between `0` and `9`.
|
|
460
|
-
*
|
|
461
|
-
* Higher values generally produce smaller files at the cost
|
|
462
|
-
* of additional processing time.
|
|
463
|
-
*
|
|
464
|
-
* - `0` = No compression
|
|
465
|
-
* - `9` = Maximum compression
|
|
466
|
-
*
|
|
467
|
-
* @default 4
|
|
468
|
-
*/
|
|
469
|
-
pngCompressionLevel?: number;
|
|
517
|
+
/**
|
|
518
|
+
* Extracts and renders a trainer's back graphic from a Firered/Leafgreen ROM.
|
|
519
|
+
*
|
|
520
|
+
* @param trainerName Name of the trainer to render.
|
|
521
|
+
* @param trainers Mapping of trainers to their index values.
|
|
522
|
+
* @param reader RomReader used for pointer resolution.
|
|
523
|
+
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
524
|
+
* @param options Optional configuration for rendering behaviour and other options.
|
|
525
|
+
*/
|
|
526
|
+
export function renderTrainerBackPic(
|
|
527
|
+
trainerName: string,
|
|
528
|
+
trainers: TrainerBackData,
|
|
529
|
+
reader: RomReader,
|
|
530
|
+
rom: RomData,
|
|
531
|
+
options?: RenderTrainerBackPicOptions & {
|
|
532
|
+
returnFileBuffer: true,
|
|
533
|
+
}
|
|
534
|
+
): Promise<RenderResultWithBuffers<RenderTrainerBackPicBufferResult>>;
|
|
535
|
+
|
|
536
|
+
export function renderTrainerBackPic(
|
|
537
|
+
trainerName: string,
|
|
538
|
+
trainers: TrainerBackData,
|
|
539
|
+
reader: RomReader,
|
|
540
|
+
rom: RomData,
|
|
541
|
+
options?: RenderTrainerBackPicOptions
|
|
542
|
+
): Promise<RenderResult>;
|
|
470
543
|
|
|
544
|
+
export interface RenderAllMovesOptions extends RenderAllGenericOptions {
|
|
471
545
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
546
|
+
* Creates the original sprite sheet version of the move graphic.
|
|
547
|
+
*
|
|
548
|
+
* Useful if you wish to display or archive the original graphic.
|
|
549
|
+
*
|
|
474
550
|
* @default true
|
|
475
551
|
*/
|
|
476
|
-
|
|
552
|
+
renderMasterImage?: boolean;
|
|
477
553
|
|
|
478
554
|
/**
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
555
|
+
* Sorts all unused moves into a sub directory.
|
|
556
|
+
*
|
|
557
|
+
* Example:
|
|
558
|
+
*
|
|
559
|
+
* If your outputDir was
|
|
560
|
+
*
|
|
561
|
+
* `out/Moves`
|
|
562
|
+
*
|
|
563
|
+
* Then this would store the unused moves in
|
|
564
|
+
*
|
|
565
|
+
* `out/Moves/unused`
|
|
566
|
+
*
|
|
483
567
|
* @default true
|
|
484
568
|
*/
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
/**
|
|
488
|
-
* Return generated image buffers instead of only writing
|
|
489
|
-
* files to disk.
|
|
490
|
-
*
|
|
491
|
-
* Useful for web servers, editors, bots, and other tools
|
|
492
|
-
* that need direct access to rendered assets.
|
|
493
|
-
*
|
|
494
|
-
* @default false
|
|
495
|
-
*/
|
|
496
|
-
returnFileBuffer?: boolean;
|
|
569
|
+
sortUnused?: boolean;
|
|
570
|
+
}
|
|
497
571
|
|
|
572
|
+
export interface RenderMoveOptions extends RenderGenericOptions {
|
|
498
573
|
/**
|
|
499
574
|
* Creates the original sprite sheet version of the move graphic.
|
|
500
575
|
*
|
|
@@ -505,12 +580,12 @@ export interface RenderAllMovesOptions {
|
|
|
505
580
|
renderMasterImage?: boolean;
|
|
506
581
|
|
|
507
582
|
/**
|
|
508
|
-
|
|
583
|
+
* Sorts all unused moves into a sub directory.
|
|
509
584
|
*
|
|
510
585
|
* Example:
|
|
511
586
|
*
|
|
512
587
|
* If your outputDir was
|
|
513
|
-
|
|
588
|
+
*
|
|
514
589
|
* `out/Moves`
|
|
515
590
|
*
|
|
516
591
|
* Then this would store the unused moves in
|
|
@@ -522,6 +597,48 @@ export interface RenderAllMovesOptions {
|
|
|
522
597
|
sortUnused?: boolean;
|
|
523
598
|
}
|
|
524
599
|
|
|
600
|
+
export interface MoveSpriteMeta {
|
|
601
|
+
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
export interface MoveFrameMeta {
|
|
605
|
+
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export type RenderAllMovesBufferResult =
|
|
609
|
+
| (RenderedAsset<MoveSpriteMeta> & {
|
|
610
|
+
category: "move";
|
|
611
|
+
asset: "sprite";
|
|
612
|
+
})
|
|
613
|
+
| (RenderedAsset<MoveFrameMeta> & {
|
|
614
|
+
category: "move";
|
|
615
|
+
asset: "frame";
|
|
616
|
+
});
|
|
617
|
+
|
|
618
|
+
export type RenderMoveBufferResult = RenderAllMovesBufferResult;
|
|
619
|
+
|
|
620
|
+
export interface Frame {
|
|
621
|
+
x: number;
|
|
622
|
+
y: number;
|
|
623
|
+
width: number;
|
|
624
|
+
height: number;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
export interface MoveDataEntry {
|
|
628
|
+
index: number;
|
|
629
|
+
animTag: string;
|
|
630
|
+
imageSize: string;
|
|
631
|
+
imageWidth: number;
|
|
632
|
+
imageHeight: number;
|
|
633
|
+
frameCount: number;
|
|
634
|
+
frames: Frame[];
|
|
635
|
+
note?: string;
|
|
636
|
+
unused?: boolean;
|
|
637
|
+
}
|
|
638
|
+
|
|
639
|
+
export type MoveData =
|
|
640
|
+
Record<string, MoveDataEntry>;
|
|
641
|
+
|
|
525
642
|
/**
|
|
526
643
|
* Extracts, renders, and cuts all move graphics from a Firered/Leafgreen ROM.
|
|
527
644
|
*
|
|
@@ -531,118 +648,72 @@ export interface RenderAllMovesOptions {
|
|
|
531
648
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
532
649
|
*/
|
|
533
650
|
export function renderAllMoves(
|
|
534
|
-
rom:
|
|
651
|
+
rom: RomData,
|
|
535
652
|
options?: RenderAllMovesOptions & {
|
|
536
653
|
returnFileBuffer: true;
|
|
537
654
|
}
|
|
538
|
-
): Promise<
|
|
655
|
+
): Promise<RenderAllResultWithBuffers<RenderAllMovesBufferResult>>;
|
|
656
|
+
|
|
657
|
+
export function renderAllMoves(
|
|
658
|
+
rom: RomData,
|
|
659
|
+
options?: RenderAllMovesOptions
|
|
660
|
+
): Promise<RenderAllResult>;
|
|
539
661
|
|
|
540
662
|
/**
|
|
541
|
-
* Extracts
|
|
542
|
-
*
|
|
543
|
-
* Handles both used and unused move graphics.
|
|
663
|
+
* Extracts and renders a move graphic from a Firered/Leafgreen ROM.
|
|
544
664
|
*
|
|
665
|
+
* @param moveName Name of the move to render.
|
|
666
|
+
* @param moves Mapping of moves to their index values, frames, and dimensions.
|
|
667
|
+
* @param reader RomReader used for pointer resolution.
|
|
545
668
|
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
546
669
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
547
670
|
*/
|
|
548
|
-
export function
|
|
549
|
-
|
|
550
|
-
|
|
671
|
+
export function renderMove(
|
|
672
|
+
moveName: string,
|
|
673
|
+
moves: MoveData,
|
|
674
|
+
reader: RomReader,
|
|
675
|
+
rom: RomData,
|
|
676
|
+
options?: RenderMoveOptions & {
|
|
677
|
+
returnFileBuffer: true,
|
|
678
|
+
}
|
|
679
|
+
): Promise<RenderResultWithBuffers<RenderMoveBufferResult>>;
|
|
680
|
+
|
|
681
|
+
export function renderMove(
|
|
682
|
+
moveName: string,
|
|
683
|
+
moves: MoveData,
|
|
684
|
+
reader: RomReader,
|
|
685
|
+
rom: RomData,
|
|
686
|
+
options?: RenderMoveOptions
|
|
551
687
|
): Promise<RenderResult>;
|
|
552
688
|
|
|
553
|
-
export interface RenderAllBallsOptions {
|
|
554
|
-
/**
|
|
555
|
-
* Directory to write extracted assets to.
|
|
556
|
-
*
|
|
557
|
-
* If omitted (set to `null`) and `returnFileBuffer` is enabled, files can be
|
|
558
|
-
* consumed directly from memory without being written to disk.
|
|
559
|
-
*
|
|
560
|
-
* @default "./out"
|
|
561
|
-
*/
|
|
562
|
-
outputDir?: string | null;
|
|
563
|
-
|
|
564
|
-
/**
|
|
565
|
-
* Number of concurrent render operations.
|
|
566
|
-
*
|
|
567
|
-
* Increase with caution. Values that are too high may reduce
|
|
568
|
-
* performance depending on available CPU and disk resources.
|
|
569
|
-
*
|
|
570
|
-
* Set to `1` to render sequentially.
|
|
571
|
-
*
|
|
572
|
-
* @default 4
|
|
573
|
-
*/
|
|
574
|
-
concurrency?: number;
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* PNG filter mode used during encoding.
|
|
578
|
-
*
|
|
579
|
-
* Accepts a value between `-1` and `4`:
|
|
580
|
-
*
|
|
581
|
-
* - `-1` = Automatically determine the best filter
|
|
582
|
-
* - `0` = None
|
|
583
|
-
* - `1` = Sub
|
|
584
|
-
* - `2` = Up
|
|
585
|
-
* - `3` = Average
|
|
586
|
-
* - `4` = Paeth
|
|
587
|
-
*
|
|
588
|
-
* Arrays may also be supplied. When an array is provided,
|
|
589
|
-
* SilphScope tests only the specified filters and selects
|
|
590
|
-
* the smallest resulting PNG.
|
|
591
|
-
*
|
|
592
|
-
* Examples:
|
|
593
|
-
*
|
|
594
|
-
* ```js
|
|
595
|
-
* pngFilterType: 0
|
|
596
|
-
* pngFilterType: -1
|
|
597
|
-
* pngFilterType: [1, 3, 4]
|
|
598
|
-
* ```
|
|
599
|
-
*
|
|
600
|
-
* @default 0
|
|
601
|
-
*/
|
|
602
|
-
pngFilterType?: PngFilterType;
|
|
603
|
-
|
|
604
|
-
/**
|
|
605
|
-
* PNG compression level.
|
|
606
|
-
*
|
|
607
|
-
* Accepts a value between `0` and `9`.
|
|
608
|
-
*
|
|
609
|
-
* Higher values generally produce smaller files at the cost
|
|
610
|
-
* of additional processing time.
|
|
611
|
-
*
|
|
612
|
-
* - `0` = No compression
|
|
613
|
-
* - `9` = Maximum compression
|
|
614
|
-
*
|
|
615
|
-
* @default 4
|
|
616
|
-
*/
|
|
617
|
-
pngCompressionLevel?: number;
|
|
618
|
-
|
|
689
|
+
export interface RenderAllBallsOptions extends RenderAllGenericOptions {
|
|
619
690
|
/**
|
|
620
|
-
*
|
|
621
|
-
*
|
|
691
|
+
* Render ball particle graphics.
|
|
692
|
+
*
|
|
622
693
|
* @default true
|
|
623
694
|
*/
|
|
624
|
-
|
|
695
|
+
ballParticles?: boolean;
|
|
625
696
|
|
|
626
697
|
/**
|
|
627
|
-
*
|
|
628
|
-
*
|
|
629
|
-
*
|
|
630
|
-
*
|
|
698
|
+
* Creates the original sprite sheet version of the ball graphic.
|
|
699
|
+
*
|
|
700
|
+
* Useful if you wish to display or archive the original graphic.
|
|
701
|
+
*
|
|
631
702
|
* @default true
|
|
632
703
|
*/
|
|
633
|
-
|
|
704
|
+
renderMasterBallImage?: boolean;
|
|
634
705
|
|
|
635
706
|
/**
|
|
636
|
-
*
|
|
637
|
-
*
|
|
638
|
-
*
|
|
639
|
-
*
|
|
640
|
-
*
|
|
641
|
-
*
|
|
642
|
-
* @default false
|
|
707
|
+
* Creates the original sprite sheet version of the ball particle graphic.
|
|
708
|
+
*
|
|
709
|
+
* Useful if you wish to display or archive the original graphic.
|
|
710
|
+
*
|
|
711
|
+
* @default true
|
|
643
712
|
*/
|
|
644
|
-
|
|
713
|
+
renderMasterBallParticleImage?: boolean;
|
|
714
|
+
}
|
|
645
715
|
|
|
716
|
+
export interface RenderBallOptions extends RenderGenericOptions {
|
|
646
717
|
/**
|
|
647
718
|
* Render ball particle graphics.
|
|
648
719
|
*
|
|
@@ -669,6 +740,50 @@ export interface RenderAllBallsOptions {
|
|
|
669
740
|
renderMasterBallParticleImage?: boolean;
|
|
670
741
|
}
|
|
671
742
|
|
|
743
|
+
export interface RenderBallParticleOptions extends RenderGenericOptions {
|
|
744
|
+
/**
|
|
745
|
+
* Creates the original sprite sheet version of the ball particle graphic.
|
|
746
|
+
*
|
|
747
|
+
* Useful if you wish to display or archive the original graphic.
|
|
748
|
+
*
|
|
749
|
+
* @default true
|
|
750
|
+
*/
|
|
751
|
+
renderMasterBallParticleImage?: boolean;
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
export interface BallSpriteMeta {
|
|
755
|
+
particleOrBall: "particle" | "ball";
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
export interface BallFrameMeta {
|
|
759
|
+
particleOrBall: "particle" | "ball";
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
export type RenderAllBallsBufferResult =
|
|
763
|
+
| (RenderedAsset<BallSpriteMeta> & {
|
|
764
|
+
category: "ball";
|
|
765
|
+
asset: "sprite";
|
|
766
|
+
})
|
|
767
|
+
| (RenderedAsset<BallFrameMeta> & {
|
|
768
|
+
category: "ball";
|
|
769
|
+
asset: "frame";
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
export type RenderBallBufferResult = RenderAllBallsBufferResult;
|
|
773
|
+
|
|
774
|
+
export type RenderBallParticleBufferResult = RenderAllBallsBufferResult;
|
|
775
|
+
|
|
776
|
+
export interface BallDataEntry {
|
|
777
|
+
index: number;
|
|
778
|
+
frameCount: number;
|
|
779
|
+
frames: Frame[];
|
|
780
|
+
particleFrameCount: number;
|
|
781
|
+
particleFrames: Frame[];
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
export type BallData =
|
|
785
|
+
Record<string, BallDataEntry>;
|
|
786
|
+
|
|
672
787
|
/**
|
|
673
788
|
* Extracts, renders, and cuts all ball graphics from a Firered/Leafgreen ROM.
|
|
674
789
|
*
|
|
@@ -678,109 +793,72 @@ export interface RenderAllBallsOptions {
|
|
|
678
793
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
679
794
|
*/
|
|
680
795
|
export function renderAllBalls(
|
|
681
|
-
rom:
|
|
796
|
+
rom: RomData,
|
|
682
797
|
options?: RenderAllBallsOptions & {
|
|
683
798
|
returnFileBuffer: true;
|
|
684
799
|
}
|
|
685
|
-
): Promise<
|
|
800
|
+
): Promise<RenderAllResultWithBuffers<RenderAllBallsBufferResult>>;
|
|
801
|
+
|
|
802
|
+
export function renderAllBalls(
|
|
803
|
+
rom: RomData,
|
|
804
|
+
options?: RenderAllBallsOptions
|
|
805
|
+
): Promise<RenderAllResult>;
|
|
686
806
|
|
|
687
807
|
/**
|
|
688
|
-
* Extracts
|
|
689
|
-
*
|
|
690
|
-
* Handles both ball and ball particle graphics.
|
|
808
|
+
* Extracts and renders a ball graphic from a Firered/Leafgreen ROM.
|
|
691
809
|
*
|
|
810
|
+
* @param ballName Name of the ball to render.
|
|
811
|
+
* @param balls Mapping of balls to their index values and frames.
|
|
812
|
+
* @param reader RomReader used for pointer resolution.
|
|
692
813
|
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
693
814
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
694
815
|
*/
|
|
695
|
-
export function
|
|
696
|
-
|
|
697
|
-
|
|
816
|
+
export function renderBall(
|
|
817
|
+
ballName: string,
|
|
818
|
+
balls: BallData,
|
|
819
|
+
reader: RomReader,
|
|
820
|
+
rom: RomData,
|
|
821
|
+
options?: RenderBallOptions & {
|
|
822
|
+
returnFileBuffer: true,
|
|
823
|
+
}
|
|
824
|
+
): Promise<RenderResultWithBuffers<RenderBallBufferResult>>;
|
|
825
|
+
|
|
826
|
+
export function renderBall(
|
|
827
|
+
ballName: string,
|
|
828
|
+
balls: BallData,
|
|
829
|
+
reader: RomReader,
|
|
830
|
+
rom: RomData,
|
|
831
|
+
options?: RenderBallOptions
|
|
698
832
|
): Promise<RenderResult>;
|
|
699
833
|
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
* Arrays may also be supplied. When an array is provided,
|
|
727
|
-
* SilphScope tests only the specified filters and selects
|
|
728
|
-
* the smallest resulting PNG.
|
|
729
|
-
*
|
|
730
|
-
* Examples:
|
|
731
|
-
*
|
|
732
|
-
* ```js
|
|
733
|
-
* pngFilterType: 0
|
|
734
|
-
* pngFilterType: -1
|
|
735
|
-
* pngFilterType: [1, 3, 4]
|
|
736
|
-
* ```
|
|
737
|
-
*
|
|
738
|
-
* @default 0
|
|
739
|
-
*/
|
|
740
|
-
pngFilterType?: PngFilterType;
|
|
741
|
-
|
|
742
|
-
/**
|
|
743
|
-
* PNG compression level.
|
|
744
|
-
*
|
|
745
|
-
* Accepts a value between `0` and `9`.
|
|
746
|
-
*
|
|
747
|
-
* Higher values generally produce smaller files at the cost
|
|
748
|
-
* of additional processing time.
|
|
749
|
-
*
|
|
750
|
-
* - `0` = No compression
|
|
751
|
-
* - `9` = Maximum compression
|
|
752
|
-
*
|
|
753
|
-
* @default 4
|
|
754
|
-
*/
|
|
755
|
-
pngCompressionLevel?: number;
|
|
756
|
-
|
|
757
|
-
/**
|
|
758
|
-
* Print progress information as assets are rendered.
|
|
759
|
-
*
|
|
760
|
-
* @default true
|
|
761
|
-
*/
|
|
762
|
-
verboseLogs?: boolean;
|
|
763
|
-
|
|
764
|
-
/**
|
|
765
|
-
* Print a summary after rendering completes.
|
|
766
|
-
*
|
|
767
|
-
* Includes render count, file count, and elapsed time.
|
|
768
|
-
*
|
|
769
|
-
* @default true
|
|
770
|
-
*/
|
|
771
|
-
showSummary?: boolean;
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Return generated image buffers instead of only writing
|
|
775
|
-
* files to disk.
|
|
776
|
-
*
|
|
777
|
-
* Useful for web servers, editors, bots, and other tools
|
|
778
|
-
* that need direct access to rendered assets.
|
|
779
|
-
*
|
|
780
|
-
* @default false
|
|
781
|
-
*/
|
|
782
|
-
returnFileBuffer?: boolean;
|
|
834
|
+
/**
|
|
835
|
+
* Extracts and renders a ball particle graphic from a Firered/Leafgreen ROM.
|
|
836
|
+
*
|
|
837
|
+
* @param ballName Name of the ball to render.
|
|
838
|
+
* @param balls Mapping of balls to their index values and frames.
|
|
839
|
+
* @param reader RomReader used for pointer resolution.
|
|
840
|
+
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
841
|
+
* @param options Optional configuration for rendering behaviour and other options.
|
|
842
|
+
*/
|
|
843
|
+
export function renderBallParticle(
|
|
844
|
+
ballName: string,
|
|
845
|
+
balls: BallData,
|
|
846
|
+
reader: RomReader,
|
|
847
|
+
rom: RomData,
|
|
848
|
+
options?: RenderBallParticleOptions & {
|
|
849
|
+
returnFileBuffer: true,
|
|
850
|
+
}
|
|
851
|
+
): Promise<RenderResultWithBuffers<RenderBallParticleBufferResult>>;
|
|
852
|
+
|
|
853
|
+
export function renderBallParticle(
|
|
854
|
+
ballName: string,
|
|
855
|
+
balls: BallData,
|
|
856
|
+
reader: RomReader,
|
|
857
|
+
rom: RomData,
|
|
858
|
+
options?: RenderBallParticleOptions
|
|
859
|
+
): Promise<RenderResult>;
|
|
783
860
|
|
|
861
|
+
export interface RenderAllGraphicsOptions extends Omit<RenderAllGenericOptions, "outputDir"> {
|
|
784
862
|
/**
|
|
785
863
|
* Directory to write extracted mon assets to.
|
|
786
864
|
*
|
|
@@ -836,7 +914,7 @@ export interface RenderAllGraphicsOptions {
|
|
|
836
914
|
*
|
|
837
915
|
* @default true
|
|
838
916
|
*/
|
|
839
|
-
sortUnusedMoves
|
|
917
|
+
sortUnusedMoves?: boolean;
|
|
840
918
|
|
|
841
919
|
/**
|
|
842
920
|
* Directory to write extracted balls assets to.
|
|
@@ -849,6 +927,13 @@ export interface RenderAllGraphicsOptions {
|
|
|
849
927
|
outputBallDir?: string;
|
|
850
928
|
}
|
|
851
929
|
|
|
930
|
+
export type RenderAllGraphicsBufferResult =
|
|
931
|
+
| RenderAllMonsBufferResult
|
|
932
|
+
| RenderAllIconsBufferResult
|
|
933
|
+
| RenderAllTrainersBufferResult
|
|
934
|
+
| RenderAllMovesBufferResult
|
|
935
|
+
| RenderAllBallsBufferResult;
|
|
936
|
+
|
|
852
937
|
/**
|
|
853
938
|
* Extracts and renders all graphics from a Firered/Leafgreen ROM.
|
|
854
939
|
*
|
|
@@ -858,21 +943,13 @@ export interface RenderAllGraphicsOptions {
|
|
|
858
943
|
* @param options Optional configuration for rendering behaviour and other options.
|
|
859
944
|
*/
|
|
860
945
|
export function renderAllGraphics(
|
|
861
|
-
rom:
|
|
946
|
+
rom: RomData,
|
|
862
947
|
options?: RenderAllGraphicsOptions & {
|
|
863
948
|
returnFileBuffer: true;
|
|
864
949
|
}
|
|
865
|
-
): Promise<
|
|
950
|
+
): Promise<RenderAllResultWithBuffers<RenderAllGraphicsBufferResult>>;
|
|
866
951
|
|
|
867
|
-
/**
|
|
868
|
-
* Extracts and renders all graphics from a Firered/Leafgreen ROM.
|
|
869
|
-
*
|
|
870
|
-
* Handles everything currently handled by all other separate render functions.
|
|
871
|
-
*
|
|
872
|
-
* @param rom The Firered/Leafgreen ROM file as a Buffer or Uint8Array.
|
|
873
|
-
* @param options Optional configuration for rendering behaviour and other options.
|
|
874
|
-
*/
|
|
875
952
|
export function renderAllGraphics(
|
|
876
|
-
rom:
|
|
953
|
+
rom: RomData,
|
|
877
954
|
options?: RenderAllGraphicsOptions
|
|
878
|
-
): Promise<
|
|
955
|
+
): Promise<RenderAllResult>;
|