silphscope 1.3.6 → 1.4.0

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.
@@ -1,85 +0,0 @@
1
- // Copyright (c) 2026 chickenPoo
2
- // Licensed under the MIT License. See LICENSE file in project root.
3
-
4
- import fs from "fs";
5
- import path from "path";
6
-
7
- const frRomMap = path.resolve("../rom-maps/pokefirered.map");
8
- const lines = fs.readFileSync(frRomMap, "utf-8").split("\n");
9
- const symbols = [];
10
-
11
- for (const line of lines) {
12
- const match = line.match(/^\s*0x([0-9a-fA-F]+)\s+([A-Za-z0-9_]+)$/);
13
- if (!match) continue;
14
-
15
- const address = parseInt(match[1], 16);
16
- const name = match[2];
17
- if (!name.startsWith('g')) continue;
18
-
19
- if (address >= 0x08d00000 && address <= 0x08ffffff) {
20
- symbols.push({ name, address });
21
- }
22
- }
23
- /**
24
- *
25
- {
26
- "name": "gMonIconPalettes",
27
- "address": 138229568,
28
- "size": 96,
29
- "offset": 4011840,
30
- "type": "palette"
31
- },
32
- {
33
- "name": "gMonIconPaletteIndices",
34
- "address": 138231424,
35
- "size": 440,
36
- "offset": 4013696,
37
- "type": "palette"
38
- },
39
-
40
- just leaving these here... they are used for the firered icon palettes and I am too lazy to add
41
- this to the "parser" for now... so yea :p
42
- */
43
-
44
- symbols.sort((a, b) => a.address - b.address);
45
-
46
- const romEnd = 0x09ffffff;
47
-
48
- function findNextAddressFromLines(currentAddress, lines) {
49
- for (const line of lines) {
50
- const match = line.match(/0x([0-9a-fA-F]+)/);
51
- if (!match) continue;
52
-
53
- const addr = parseInt(match[1], 16);
54
- if (addr > currentAddress) return addr;
55
- }
56
- return null;
57
- }
58
-
59
- for (let i = 0; i < symbols.length; i++) {
60
- const current = symbols[i];
61
- const next = symbols[i + 1];
62
- current.size = next
63
- ? next.address - current.address
64
- : romEnd - current.address; // really not needed anymore since like I actually fixed the thing instead of relying on this garbage thingy
65
- current.offset = current.address - 0x08000000;
66
- if (!next) {
67
- const nextAddress = findNextAddressFromLines(current.address, lines);
68
- current.size = nextAddress
69
- ? nextAddress - current.address
70
- : 0;
71
- }
72
- }
73
-
74
- function classifyType(name) {
75
- if (name.includes('Pal')) return "palette";
76
- if (name.includes("Tilemap")) return "tilemap";
77
- if (name.includes("Gfx") || name.includes("Pic")) return "gfx";
78
- return "unknown";
79
- }
80
-
81
- for (const sym of symbols) {
82
- sym.type = classifyType(sym.name);
83
- }
84
-
85
- fs.writeFileSync("../graphics-maps/fr-graphic-map.json", JSON.stringify(symbols, null, 2));