silphscope 1.4.22 → 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 CHANGED
@@ -1,147 +1,249 @@
1
- still a WIP however hopefully with some more work I can get this into a workable state...
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
- (Small But New Update!) Update:
6
+ Hello! I have no idea how you found this repo but welcome! (did I already scare you off? :[)
4
7
 
5
- so you can now set stuff such as the pngFilterType and pngCompressionLevel allow me to explain how they work:
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
- pngFilterType:
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
- This takes a integer between -1 and 4 with each integer corresponding like so:
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
- -1: auto
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
- now as to what each of these mean... I don't know exactly lol (I'm not some png genius D:) but from what I understand none of these actually change the look of the image instead they are basically compression some will work better with different images depending on content... that said though it is still somewhat important to point out that paeth is the most computationally expensive but usually results in a smaller file size (most of the time... for an example one image might get marginal file size decreases with a paeth filter meanwhile it would get a larger decrease using average or something) if you do not want to deal with trying to figure out which filter is best it is recommended to set the value to 0 as that will apply no filter onto the image or if you wish for the best filter for each image type to be applied use -1 as this will make it so that each image is tested for which filter is best for it and which is best is applied be aware though this is pretty expensive resource wise (can add on to like 2 seconds to the renderAllGraphics() function... so not crazy but if you need upmost speed perhaps that is an issue for you :p) you can also however pass an array like so:
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
- [1, 3, 4]
30
+ ## Features
21
31
 
22
- this will make it so that the only png filters allowed to be used are 1, 3, and 4 (sub, average, and paeth) so each image will be tested for each of these filters and the best is chosen out of however many filters you put in the array (not sure why you would want to do this but it's there I guess...)
32
+ Here is the current list of extracted graphics the project supports (more on the way!... eventually :p)
23
33
 
24
- pngCompressionLevel:
34
+ #### Mon
35
+ - Front sprites
36
+ - Back sprites
37
+ - Shiny palette sprite variants
38
+ - Icons
39
+ - Footprints
25
40
 
26
- This one is much simpler it essentially takes a integer between 0-9 with 0 being no compression added at all and 9 being the maximum compression added of course though this also uses more resources so it could cause the render time to be slower (like by 1-2 seconds... once again not crazy but sometimes you need speed I guess... wait I should mention that is measured via the renderAllGraphics() function not 1-2 seconds per asset lol) but it will result in a smaller file meanwhile 0 will be the fastest you can do (since you aren't computing anything...) but it will result in a much larger file
41
+ #### Items
42
+ - Item icons
27
43
 
28
- (Amazingly Newer!) Update:
44
+ #### Trainers
45
+ - Trainer sprites
46
+ - Trainer back sprites
29
47
 
30
- so now ball extraction works! still need to cut the images up but that should be simple
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
- (also move graphics are basically done except for ICE_CHUNK it is a weird image... and I don't know how I am going to cut it up... but everything else is working! that makes it sound like ICE_CHUNK doesn't work... which it does it just doesn't get nicely cut up)
54
+ #### Output
55
+ - PNG file export
56
+ - In memory file buffer array
33
57
 
34
- (Even Newer!) Update:
58
+ #### Supported ROMs
59
+ - Firered (USA) Rev0
35
60
 
36
- moves now work... kinda... still working on getting it all the way done but it mostly works!
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
- (Newer!) Update:
71
+ ## Quick Start
39
72
 
40
- still a WIP :p but erm you can extract more graphics!
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
- Update:
43
-
44
- so the project is semi-usable now you can download it as a npm package via:
75
+ ```
76
+ npm install silphscope
77
+ ```
45
78
 
46
- npm install silphscope
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"); // replace with path to your own firered rom
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
- Of course though the above is for extracting all graphics (which is kinda a lie... In reality it only extracts mon images, item icons, trainer images, move images, and ball images... but like I said this is a WIP :p so wait a bit please!).
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
- But if you want say just the mon images or item icons refer below:
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")// once again replace with the path to your own firered rom
179
+ const rom = fs.readFileSync("pokefirered.gba");
78
180
  await renderAllMons(rom, {
79
- 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...)
80
- pngFilterType: 0, // explanation above
81
- pngCompressionLevel: 4, // explanation above
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
- item icon extraction:
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")// find your own rom and so on :l
195
+ const rom = fs.readFileSync("pokefirered.gba");
94
196
  await renderAllIcons(rom, {
95
- 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...)
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
- trainer image extraction:
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") // stuff stuff stuff
209
+ const rom = fs.readFileSync("pokefirered.gba");
108
210
  await renderAllTrainers(rom, {
109
- 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...)
110
- pngFilterType: 0, // explanation above
111
- pngCompressionLevel: 4, // explanation above
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
- move image extraction:
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") // stuff stuff stuff (more stuff!)
224
+ const rom = fs.readFileSync("pokefirered.gba");
123
225
  await renderAllMoves(rom, {
124
- 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...)
125
- pngFilterType: 0, // explanation above
126
- pngCompressionLevel: 4, // explanation above
127
- outputDir: "./Assets/trainers", // (incredibly) more stuff
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
- ball image extraction:
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("./path/to/your/rom.gba") // the file path explains :/
240
+ const rom = fs.readFileSync("pokefirered.gba");
139
241
  await renderAllBalls(rom, {
140
- 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...)
141
- pngFilterType: 0, // explanation above
142
- pngCompressionLevel: 4, // explanation above
143
- outputDir: "./Assets/Balls",
144
- ballParticles: true, // set to false if you don't want the ball particles :p
145
- renderMasterBallImage: true, // set to false if you don't want the uncut image
146
- renderMasterBallParticleImage: true, // set to false if you also don't want the uncut particle image :p
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