This commit is contained in:
1 parent
6a74f59e46
commit
3e92936cb9
20 files changed
+1417
-32
No files matched your search
@@ -38,6 +38,12 @@ const symbols = new Map(
|
||||
}),
|
||||
);
|
||||
const names = {
|
||||
trainerGroups: "TrainerGroups",
|
||||
trainerClassNames: "TrainerClassNames",
|
||||
trainerClassAttributes: "TrainerClassAttributes",
|
||||
trainerClassDVs: "TrainerClassDVs",
|
||||
statusOnlyEffects: "StatusOnlyEffects",
|
||||
residualMoves: "ResidualMoves",
|
||||
mapGroups: "MapGroupPointers",
|
||||
tilesets: "Tilesets",
|
||||
collisions: "CollisionPermissionTable",
|
||||
@@ -136,6 +142,7 @@ const ram = new Map(
|
||||
}),
|
||||
);
|
||||
const ramNames = {
|
||||
battleReward: "wBattleReward",
|
||||
stringBuffer1: "wStringBuffer1",
|
||||
stringBuffer2: "wStringBuffer2",
|
||||
stringBuffer3: "wStringBuffer3",
|
||||
@@ -156,12 +163,12 @@ const ramNames = {
|
||||
};
|
||||
const profile = readFileSync("src/game/rom/profile.ts", "utf8");
|
||||
for (const [key, symbol] of Object.entries(names)) {
|
||||
const match = new RegExp(`${key}:\\s*(0x[0-9a-f]+)`, "i").exec(profile);
|
||||
const match = new RegExp(`\\b${key}:\\s*(0x[0-9a-f]+)`, "i").exec(profile);
|
||||
if (!match || Number(match[1]) !== symbols.get(symbol))
|
||||
throw new Error(`Profile address mismatch: ${key} / ${symbol}`);
|
||||
}
|
||||
for (const [key, symbol] of Object.entries(ramNames)) {
|
||||
const match = new RegExp(`${key}:\\s*(0x[0-9a-f]+)`, "i").exec(profile);
|
||||
const match = new RegExp(`\\b${key}:\\s*(0x[0-9a-f]+)`, "i").exec(profile);
|
||||
if (!match || Number(match[1]) !== ram.get(symbol))
|
||||
throw new Error(`Profile RAM mismatch: ${key} / ${symbol}`);
|
||||
}
|
||||
@@ -175,6 +182,8 @@ for (const [key, symbol] of Object.entries(ramNames)) {
|
||||
throw new Error(`Battle symbol mismatch: ${label}`);
|
||||
}
|
||||
}
|
||||
if (!profile.includes(`NUM_TRAINER_CLASSES = ${(symbols.get("Trainers") - symbols.get("TrainerGroups")) / 2};`))
|
||||
throw new Error("Trainer class count does not match the reference.");
|
||||
const eventIds = new Map();
|
||||
{
|
||||
let next = 0;
|
||||
@@ -201,7 +210,7 @@ const eventNames = {
|
||||
playersHouseBigDoll: "EVENT_PLAYERS_HOUSE_2F_BIG_DOLL",
|
||||
};
|
||||
for (const [key, name] of Object.entries(eventNames)) {
|
||||
const match = new RegExp(`${key}:\\s*(\\d+)`).exec(profile);
|
||||
const match = new RegExp(`\\b${key}:\\s*(\\d+)`).exec(profile);
|
||||
if (!match || Number(match[1]) !== eventIds.get(name))
|
||||
throw new Error(`Profile event mismatch: ${key} / ${name}`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user