silphscope 1.2.29 → 1.2.31
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
|
@@ -87,13 +87,12 @@ export async function renderAllTrainers(rom, options = {}) {
|
|
|
87
87
|
} = options;
|
|
88
88
|
|
|
89
89
|
fs.mkdirSync(outputDir, { recursive: true });
|
|
90
|
-
const backTrainerName = Object.keys(providedBackTrainers);
|
|
91
90
|
|
|
92
91
|
const config = getRomConfig(rom);
|
|
93
92
|
const reader = new RomReader(rom, config);
|
|
94
93
|
|
|
95
94
|
for (const trainerName of Object.keys(providedTrainers)) {
|
|
96
|
-
await renderTrainer(trainerName, providedTrainers,
|
|
95
|
+
await renderTrainer(trainerName, providedTrainers, providedBackTrainers, reader, rom, {
|
|
97
96
|
trainerBackPics,
|
|
98
97
|
outputDir
|
|
99
98
|
});
|
|
@@ -16,7 +16,7 @@ const streamToBuffer = (stream) => new Promise((resolve, reject) => {
|
|
|
16
16
|
stream.on("error", reject);
|
|
17
17
|
});
|
|
18
18
|
|
|
19
|
-
export async function renderTrainer(trainerName, trainers,
|
|
19
|
+
export async function renderTrainer(trainerName, trainers, backTrainers, reader, rom, options = {}) {
|
|
20
20
|
const {
|
|
21
21
|
trainerBackPics = false,
|
|
22
22
|
outputDir = null,
|
|
@@ -30,7 +30,16 @@ export async function renderTrainer(trainerName, trainers, backTrainerName, back
|
|
|
30
30
|
throw new Error(`Missing Trainer: ${trainerName}`);
|
|
31
31
|
}
|
|
32
32
|
if (trainerBackPics) {
|
|
33
|
-
|
|
33
|
+
const backTrainerName = backTrainers[trainerName]
|
|
34
|
+
? trainerName
|
|
35
|
+
: false;
|
|
36
|
+
if (backTrainerName) {
|
|
37
|
+
await renderTrainerBackPic(backTrainerName, backTrainers, reader, rom, { outputDir }); // that could have been bad lol I forgot to add await :p
|
|
38
|
+
}
|
|
39
|
+
else if (backTrainerName === false && trainerName === "PAINTER") {
|
|
40
|
+
await renderTrainerBackPic("OLDMAN", backTrainers, reader, rom, { outputDir });
|
|
41
|
+
await renderTrainerBackPic("POKEDUDE", backTrainers, reader, rom, { outputDir });
|
|
42
|
+
}
|
|
34
43
|
}
|
|
35
44
|
const trainerPal = resolveTrainerFrontPicPal(trainer, reader, trainerName);
|
|
36
45
|
const trainerPic = resolveTrainerFrontPic(trainer, reader, trainerName);
|
|
@@ -2,8 +2,15 @@ export function resolveTrainerBackPic(trainer, reader, trainerName) {
|
|
|
2
2
|
const table = reader.getTable("trainerBackPicTable");
|
|
3
3
|
const entryOffset = table + trainer.index * 8;
|
|
4
4
|
const ptr = reader.readPointer(entryOffset);
|
|
5
|
+
let size;
|
|
6
|
+
if (trainerName === "RED" || trainerName === "LEAF") {
|
|
7
|
+
size = 10240;
|
|
8
|
+
} else {
|
|
9
|
+
size = 8192;
|
|
10
|
+
}
|
|
5
11
|
return {
|
|
6
12
|
name: `trainer_${trainerName}_back_pic`,
|
|
7
13
|
offset: ptr,
|
|
14
|
+
size,
|
|
8
15
|
}
|
|
9
16
|
}
|