silphscope 1.3.3 → 1.3.4

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.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "A firered/leafgreen ROM asset extractor for use in web applications",
5
5
  "main": "main.js",
6
6
  "exports": {
@@ -105,6 +105,7 @@ export async function renderAllMoves(rom, options = {}) {
105
105
  moves: providedMoves = moves,
106
106
  outputDir = "./out",
107
107
  renderMasterImage = true,
108
+ sortUnused = true,
108
109
  } = options;
109
110
 
110
111
  fs.mkdirSync(outputDir, { recursive: true });
@@ -115,7 +116,8 @@ export async function renderAllMoves(rom, options = {}) {
115
116
  for (const moveName of Object.keys(providedMoves)) {
116
117
  await renderMove(moveName, providedMoves, reader, rom, {
117
118
  outputDir,
118
- renderMasterImage,
119
+ renderMasterImage,
120
+ sortUnused,
119
121
  });
120
122
  console.log(`Done: ${moveName}`);
121
123
  }
@@ -130,7 +132,8 @@ export async function renderAllGraphics(rom, options = {}) { // eventually I wil
130
132
  outputMonDir = "./out/mons",
131
133
  outputIconDir = "./out/icons",
132
134
  outputTrainerDir = "./out/trainers",
133
- outputMoveDir = "./out/moves"
135
+ outputMoveDir = "./out/moves",
136
+ sortUnused = true,
134
137
  } = options;
135
138
 
136
139
  await renderAllMons(rom, {
@@ -151,6 +154,7 @@ export async function renderAllGraphics(rom, options = {}) { // eventually I wil
151
154
  await renderAllMoves(rom, {
152
155
  outputDir: outputMoveDir,
153
156
  renderMasterImage: true,
157
+ sortUnused,
154
158
  })
155
159
  }
156
160
 
@@ -39,6 +39,7 @@ export async function renderMove(moveName, moves, reader, rom, options = {}) {
39
39
  const {
40
40
  outputDir = null,
41
41
  renderMasterImage = false,
42
+ sortUnused = false,
42
43
  } = options;
43
44
  if (!rom || !(rom instanceof Uint8Array || Buffer.isBuffer(rom))) {
44
45
  throw new TypeError("renderMove(..., rom) requires a ROM Buffer/Uint8Array");
@@ -68,7 +69,8 @@ export async function renderMove(moveName, moves, reader, rom, options = {}) {
68
69
  });
69
70
 
70
71
  if (outputDir) { // I will update this later but in theory it should also work... eventually though it will need a split inside to handle full image generation :p
71
- const dir = `${outputDir}/${moveName}`;
72
+ const rootDir = (move?.unused === true)? `${outputDir}/unused` : `${outputDir}`
73
+ const dir = `${rootDir}/${moveName}`;
72
74
  if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true });
73
75
  if (renderMasterImage) {
74
76
  const png = new PNG({ width, height });