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/README.md
CHANGED
|
@@ -1,147 +1,249 @@
|
|
|
1
|
-
|
|
1
|
+
<h1 align="center">SilphScope</h1>
|
|
2
|
+
<p align="center">
|
|
3
|
+
<sub><s>Yup I finally got around to updating this "horrible" README :p</s></sub>
|
|
4
|
+
</p>
|
|
2
5
|
|
|
3
|
-
|
|
6
|
+
Hello! I have no idea how you found this repo but welcome! (did I already scare you off? :[)
|
|
4
7
|
|
|
5
|
-
so you
|
|
8
|
+
>It is probably important to mention this but the project is still quite heavily in its WIP phase... so maybe wait a few more months or something before you rely on the project fully... or just keep your working version of the project and don't update it unless you know for sure the new version is working lol
|
|
6
9
|
|
|
7
|
-
|
|
10
|
+
Anyway this project is quite cool (says the guy who made it...) essentially what we (me...) are doing here is trying to take a GBA Firered/Leafgreen rev0/rev1 US release ROM and be able to extract things such as graphics and eventually sounds and songs into something more usable like a PNG or WAV respectively. While being far more portable and non-dev friendly than the C/C++ tools from the caveman ages (actually though I must say this tool owes a lot to those projects... otherwise things would have taken far longer... not to say all the answers were just hidden in them but they helped in a bunch of ways!)
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
Why would you want this? Well you really don't :p unless of course you happen to need these graphics in which case this will be the next best invention save for orange juice!
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
0: none
|
|
13
|
-
1: sub
|
|
14
|
-
2: up
|
|
15
|
-
3: average
|
|
16
|
-
4: paeth
|
|
14
|
+
Welp enough chitchat let's get into how you actually use this tool (or wait... would it be a library? eh doesn't matter :p) below is a (super cool) Table of Contents you can use to jump through this long-ish README if you are only interested in specific parts
|
|
17
15
|
|
|
18
|
-
|
|
16
|
+
## Table of Contents
|
|
17
|
+
- [Features](#features)
|
|
18
|
+
- [Planned Features](#planned-features)
|
|
19
|
+
- [Quick Start](#quick-start)
|
|
20
|
+
- [API](#api)
|
|
21
|
+
- [renderAllX() Functions](#renderallx-functions)
|
|
22
|
+
- [Return value](#return-value)
|
|
23
|
+
- [renderAllGraphics()](#renderallgraphics)
|
|
24
|
+
- [renderAllMons()](#renderallmons)
|
|
25
|
+
- [renderAllIcons()](#renderallicons)
|
|
26
|
+
- [renderAllTrainers()](#renderalltrainers)
|
|
27
|
+
- [renderAllMoves()](#renderallmoves)
|
|
28
|
+
- [renderAllBalls()](#renderallballs)
|
|
19
29
|
|
|
20
|
-
|
|
30
|
+
## Features
|
|
21
31
|
|
|
22
|
-
|
|
32
|
+
Here is the current list of extracted graphics the project supports (more on the way!... eventually :p)
|
|
23
33
|
|
|
24
|
-
|
|
34
|
+
#### Mon
|
|
35
|
+
- Front sprites
|
|
36
|
+
- Back sprites
|
|
37
|
+
- Shiny palette sprite variants
|
|
38
|
+
- Icons
|
|
39
|
+
- Footprints
|
|
25
40
|
|
|
26
|
-
|
|
41
|
+
#### Items
|
|
42
|
+
- Item icons
|
|
27
43
|
|
|
28
|
-
|
|
44
|
+
#### Trainers
|
|
45
|
+
- Trainer sprites
|
|
46
|
+
- Trainer back sprites
|
|
29
47
|
|
|
30
|
-
|
|
48
|
+
#### Battle Assets
|
|
49
|
+
(well technically the trainers should be here... but don't worry about that!)
|
|
50
|
+
- Move animation graphics
|
|
51
|
+
- Ball sprites
|
|
52
|
+
- Ball particles
|
|
31
53
|
|
|
32
|
-
|
|
54
|
+
#### Output
|
|
55
|
+
- PNG file export
|
|
56
|
+
- In memory file buffer array
|
|
33
57
|
|
|
34
|
-
|
|
58
|
+
#### Supported ROMs
|
|
59
|
+
- Firered (USA) Rev0
|
|
35
60
|
|
|
36
|
-
|
|
61
|
+
### Planned Features
|
|
62
|
+
- More graphical extraction
|
|
63
|
+
- Expose some more low level functions
|
|
64
|
+
- Make
|
|
65
|
+
- ~~(finish my other project... that just so happens to be reliant on this project...)~~
|
|
66
|
+
- Support the following ROMs:
|
|
67
|
+
- Firered (USA) rev1
|
|
68
|
+
- Leafgreen (USA) rev0
|
|
69
|
+
- Leafgreen (USA) rev1
|
|
37
70
|
|
|
38
|
-
|
|
71
|
+
## Quick Start
|
|
39
72
|
|
|
40
|
-
|
|
73
|
+
So in general you can currently do everything the package currently offers through just one function! (Do keep in mind though this function will keep growing as the project isn't done yet...) But first we kinda have to get the package installed first... so run this to go ahead and download it!
|
|
41
74
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
75
|
+
```
|
|
76
|
+
npm install silphscope
|
|
77
|
+
```
|
|
45
78
|
|
|
46
|
-
|
|
47
|
-
(or `pnpm install silphscope` if you like pnpm like me ;] )
|
|
79
|
+
(or if you're like me use `pnpm install silphscope` ;))
|
|
48
80
|
|
|
49
|
-
general use is something like this:
|
|
50
81
|
```JavaScript
|
|
82
|
+
import { renderAllGraphics } from "silphscope"; // still cool!
|
|
51
83
|
import fs from "fs";
|
|
52
|
-
import { renderAllGraphics } from "silphscope"; // this is cool...
|
|
53
84
|
|
|
54
|
-
const rom = fs.readFileSync("pokefirered.gba"); //
|
|
85
|
+
const rom = fs.readFileSync("pokefirered.gba"); // remember get your own ROM!
|
|
55
86
|
await renderAllGraphics(rom, {
|
|
56
|
-
concurrency: 4, // handles how many concurrent promises are run. Set to 1 to run sequentially and conversly increase to run more promises at once (don't set too high though if your CPU / I/O can't handle it then it might actually be slower...)
|
|
57
|
-
pngFilterType: 0, // view the explanation for this above
|
|
58
|
-
pngCompressionLevel: 4, // same thing :p explanation above
|
|
59
87
|
outputMonDir: "./Assets/monImages", // must I explain?
|
|
60
88
|
outputIconDir: "./Assets/Icons", // same thing here :p
|
|
61
89
|
outputTrainerDir: "./Assets/Trainers", // ...
|
|
62
90
|
outputMoveDir: "./Assets/Moves",
|
|
63
|
-
sortUnusedMoves: true, // just sorts the unused moves into a sub-directory
|
|
64
91
|
outputBallDir: "./Assets/Balls"
|
|
65
92
|
});
|
|
66
93
|
```
|
|
67
94
|
|
|
68
|
-
|
|
95
|
+
And with that simply run the file and next thing you know you have around 6k images extracted from your very own local ROM! if you would like to see more in depth explanations of the function options or what more the package is capable of keep reading below or jump back to the table of contents and skip around (you aren't too far from it yet!)
|
|
96
|
+
|
|
97
|
+
## API
|
|
98
|
+
|
|
99
|
+
To start off this will simply be going over the possible Node.js based functions and a general sense of what they do. If you want a more in depth explanation of things (such as what each option does, a more in depth explanation of the function, etc...) you will probably want to view the documentation folder.
|
|
100
|
+
|
|
101
|
+
For reference perhaps you need to know all the options of renderAllGraphics and what exactly they do you would go view these documentation files for those answers:
|
|
102
|
+
|
|
103
|
+
Node based renderAllGraphics() in depth explanation: docs/node/renderAllGraphics.md or click [here](./docs/node/renderAllGraphics.md)
|
|
104
|
+
|
|
105
|
+
Node based renderAll function options: docs/node/renderAllX-options.md or click [here](./docs/node/renderAllX-options.md)
|
|
106
|
+
|
|
107
|
+
### renderAllX() Functions
|
|
108
|
+
|
|
109
|
+
So all Node based `renderAllX()` functions have a bit of similarites you can find them listed below:
|
|
110
|
+
|
|
111
|
+
#### Input
|
|
112
|
+
|
|
113
|
+
Every node based `renderAllX()` function:
|
|
114
|
+
|
|
115
|
+
- Accepts a valid and supported ROM as either a `Buffer` or `Uint8Array`
|
|
116
|
+
- Accepts an optional options object
|
|
117
|
+
|
|
118
|
+
#### Return value
|
|
119
|
+
|
|
120
|
+
All Node based `renderAllX()` functions return an object with two values like this:
|
|
121
|
+
|
|
122
|
+
```JavaScript
|
|
123
|
+
{
|
|
124
|
+
totalFileCount: number,
|
|
125
|
+
finalResults?: [],
|
|
126
|
+
}
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Of course though it is very important to specify that `finalResults` is not always there it only appears if the `returnFileBuffer` option is set to `true` upon running any renderAll function otherwise your return value will only contain `totalFileCount`
|
|
130
|
+
|
|
131
|
+
speaking of which `totalFileCount` is a simple variable that returns only however many files were written during a run if you have your `outputDir` variable(s) set to `null` and only generate the file buffer via `returnFileBuffer` being set to `true` this count will not go up
|
|
132
|
+
|
|
133
|
+
#### Shared options
|
|
134
|
+
|
|
135
|
+
Each node based `renderAllX()` function has a few shared options contained within their optional options object. Below are said options and their default values:
|
|
136
|
+
|
|
137
|
+
```JavaScript
|
|
138
|
+
{
|
|
139
|
+
concurrency: 4,
|
|
140
|
+
pngFilterType: 0,
|
|
141
|
+
pngCompressionLevel: 4,
|
|
142
|
+
verboseLogs: true,
|
|
143
|
+
showSummary: true,
|
|
144
|
+
returnFileBuffer: false,
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
If you would like to know more about these function options please view this file:
|
|
149
|
+
|
|
150
|
+
[renderAllX-options.md](./docs/node/renderAllX-options.md)
|
|
151
|
+
|
|
152
|
+
#### renderAllGraphics()
|
|
153
|
+
|
|
154
|
+
This is currently the "general use" function of the project it is capable of extracting every currently supported graphic from a valid ROM. Below is the simplest example of renderAllGraphics().
|
|
155
|
+
|
|
156
|
+
```JavaScript
|
|
157
|
+
import { renderAllGraphics } from "silphscope";
|
|
158
|
+
import fs from "fs";
|
|
159
|
+
|
|
160
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
161
|
+
await renderAllGraphics(rom, {
|
|
162
|
+
returnFileBuffer: false,
|
|
163
|
+
outputMonDir: "./out/mons",
|
|
164
|
+
outputIconDir: "./out/icons",
|
|
165
|
+
outputTrainerDir: "./out/trainers",
|
|
166
|
+
outputMoveDir: "./out/moves",
|
|
167
|
+
outputBallDir: "./out/balls",
|
|
168
|
+
});
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
#### renderAllMons()
|
|
69
172
|
|
|
70
|
-
|
|
173
|
+
This function is specifically responsible for rendering all of the mon graphics so the front/back shiny/normal, mon icons, and footprints are all handled here. Below is the example code for `renderAllMons()`
|
|
71
174
|
|
|
72
|
-
mon images extraction:
|
|
73
175
|
```JavaScript
|
|
176
|
+
import { renderAllMons } from "silphscope";
|
|
74
177
|
import fs from "fs";
|
|
75
|
-
import { renderAllMons } from "silphscope"; // never gets old :p
|
|
76
178
|
|
|
77
|
-
const rom = fs.readFileSync("pokefirered.gba")
|
|
179
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
78
180
|
await renderAllMons(rom, {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
outputDir: "./Assets/monImages", // do I actually have to explain?
|
|
83
|
-
icon: true, // set to false if you don't want icons I guess...
|
|
84
|
-
footprint: true, // same as the above...
|
|
181
|
+
outputDir: "./out",
|
|
182
|
+
icon: true,
|
|
183
|
+
footprint: true,
|
|
85
184
|
});
|
|
86
185
|
```
|
|
87
186
|
|
|
88
|
-
|
|
187
|
+
#### renderAllIcons()
|
|
188
|
+
|
|
189
|
+
`renderAllIcons()` is specifically meant for item icons contained within the ROM. so for the graphics that appear when looking inside your bag at items in game. Below is the function example code
|
|
190
|
+
|
|
89
191
|
```JavaScript
|
|
192
|
+
import { renderAllIcons } from "silphscope";
|
|
90
193
|
import fs from "fs";
|
|
91
|
-
import { renderAllIcons } from "silphscope" // :D
|
|
92
194
|
|
|
93
|
-
const rom = fs.readFileSync("pokefirered.gba")
|
|
195
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
94
196
|
await renderAllIcons(rom, {
|
|
95
|
-
|
|
96
|
-
pngFilterType: 0, // explanation above
|
|
97
|
-
pngCompressionLevel: 4, // explanation above
|
|
98
|
-
outputDir: "./Assets/Icons" // no comment (wait... that was a comment :p)
|
|
197
|
+
outputDir: "./out",
|
|
99
198
|
});
|
|
100
199
|
```
|
|
101
200
|
|
|
102
|
-
|
|
201
|
+
#### renderAllTrainers()
|
|
202
|
+
|
|
203
|
+
This function handles both front and back graphics for trainers contained within the ROM. Here is the example code
|
|
204
|
+
|
|
103
205
|
```JavaScript
|
|
206
|
+
import { renderAllTrainers } from "silphscope";
|
|
104
207
|
import fs from "fs";
|
|
105
|
-
import { renderAllTrainers } from "silphscope" // :O
|
|
106
208
|
|
|
107
|
-
const rom = fs.readFileSync("pokefirered.gba")
|
|
209
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
108
210
|
await renderAllTrainers(rom, {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
outputDir: "./Assets/trainers", // more stuff
|
|
113
|
-
trainerBackPics: true, // renders the like 8 trainer back pics
|
|
114
|
-
})
|
|
211
|
+
outputDir: "./out",
|
|
212
|
+
trainerBackPics: true,
|
|
213
|
+
});
|
|
115
214
|
```
|
|
116
215
|
|
|
117
|
-
|
|
216
|
+
#### renderAllMoves()
|
|
217
|
+
|
|
218
|
+
(this function was a lot of work... specifically the image splitting... but you don't have to worry about that dear user as I have already suffered through completing all of that "logic") This function is for all battle move graphics contained within the game it is responsible for extracting said graphics as well as cutting them from their spritesheets into individual images. Below is the code example
|
|
219
|
+
|
|
118
220
|
```JavaScript
|
|
221
|
+
import { renderAllMoves } from "silphscope";
|
|
119
222
|
import fs from "fs";
|
|
120
|
-
import { renderAllMoves } from "silphscope" // :O
|
|
121
223
|
|
|
122
|
-
const rom = fs.readFileSync("pokefirered.gba")
|
|
224
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
123
225
|
await renderAllMoves(rom, {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
renderMasterImage: true, // kinda forgot about this... basically it renders a uncut image of the move anim if you like
|
|
129
|
-
sortUnused: true, // sorts unused moves into a sub-directory
|
|
130
|
-
})
|
|
226
|
+
outputDir: "./out",
|
|
227
|
+
renderMasterImage: true,
|
|
228
|
+
sortUnused: true,
|
|
229
|
+
});
|
|
131
230
|
```
|
|
132
231
|
|
|
133
|
-
|
|
232
|
+
#### renderAllBalls()
|
|
233
|
+
|
|
234
|
+
`renderAllBalls()` is responsible for rendering both ball graphics and ball particle graphics. Below is the example code:
|
|
235
|
+
|
|
134
236
|
```JavaScript
|
|
237
|
+
import { renderAllBalls } from "silphscope";
|
|
135
238
|
import fs from "fs";
|
|
136
|
-
import { renderAllBalls } from "silphscope" // o-O
|
|
137
239
|
|
|
138
|
-
const rom = fs.readFileSync("
|
|
240
|
+
const rom = fs.readFileSync("pokefirered.gba");
|
|
139
241
|
await renderAllBalls(rom, {
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
242
|
+
outputDir: "./out",
|
|
243
|
+
ballParticles: true,
|
|
244
|
+
renderMasterBallImage: true,
|
|
245
|
+
renderMasterBallParticleImage: true,
|
|
246
|
+
});
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
~~(you actually read all of this? well anyway the readme isn't done yet... so this is weird... want a virtual cookie?)~~
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|