Measure, weigh and name the European releases' own way (#84)
Checks / web (push) Failing after 19s
Private ROM checks / private-rom (push) Failing after 27m7s

The French, German, Italian and Spanish releases store Magikarp's
length in millimetres (and print a tenth of them), start the Magikarp
house's record at their own length and holder, keep Pokédex heights in
decimetres and weights in hectograms (printed in metres and kilograms),
read the Heavy Ball's weight byte without converting it, and place the
enemy's nickname before EnemyText (French, Italian) or the trainer's
name before the class (French, Italian, Spanish).

map-revision --symbols writes each release's symbol file, so the
reference specs run against a release; specs that pin English data skip
there.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
kawaandClaude Opus 5.5 committed 2026-10-17 19:04:51 +02:00
1 parent 627f87d8b5
commit d3e3faff72
15 files changed
+246 -63

No files matched your search

+59 -3
View File
@@ -1,11 +1,15 @@
import { describe, expect, it } from "vitest";
import { existsSync, readFileSync } from "node:fs";
import { CrystalAssets } from "../src/game/rom/assets";
import { JOHTO, MENU } from "../src/game/rom/profile";
import { revisionAddresses, romRevision } from "../src/game/rom/revision";
import { JOHTO, MENU, RAM } from "../src/game/rom/profile";
import { initialMagikarpRecord, magikarpHouseSign } from "../src/game/scripts/lake-of-rage";
import { magikarpLength, magikarpLengthBytes } from "../src/game/battle/battle";
import { revisionAddresses, romRevision, useRevision } from "../src/game/rom/revision";
import { RomReader } from "../src/game/rom/reader";
import { RELEASES_IN_PROGRESS, validateRom } from "../src/rom/validate";
import { readString } from "../src/game/scripts/text";
import { defaultTextContext, readString } from "../src/game/scripts/text";
import { textTiles } from "../src/game/rom/font";
import { dexHeight, dexWeight } from "../src/game/rom/pokedex";
import { Playthrough } from "./playthrough-driver";
/** The European releases at the repository root, each skipped when absent. */
@@ -78,3 +82,55 @@ for (const { language, rom, release } of releases)
expect(p.world.notice).toBe("");
});
});
describe("the European releases' word order", () => {
it("places the enemy's nickname before EnemyText in French and Italian", () => {
// <USER> on the enemy's turn ($5a), then the terminator.
const reader = new RomReader(new Uint8Array([0x5a, 0x50]));
const name = (revision: Parameters<typeof useRevision>[0], prefix: string) => {
useRevision(revision);
return readString(reader, 0, {
...defaultTextContext("KAWA"),
battle: { turn: 1, player: "CYNDAQUIL", enemy: "RATTATA", enemyPrefix: prefix },
});
};
expect(name("fr", " ennemi")).toBe("RATTATA ennemi");
expect(name("it", " nemico")).toBe("RATTATA nemico");
expect(name("de", "Gegn. ")).toBe("Gegn. RATTATA");
expect(name("1.1", "Enemy ")).toBe("Enemy RATTATA");
});
});
describe.skipIf(!existsSync(releases[0].rom))("the European releases' Magikarp", () => {
it("measure in millimetres and print a tenth of them, from 105.3 by the release's own holder", () => {
const bytes = new Uint8Array(readFileSync(releases[0].rom));
const assets = new CrystalAssets(bytes);
const record = initialMagikarpRecord(assets.reader);
// InitializeMagikarpHouse's bytes: 1053 mm.
expect([record.feet, record.inches]).toEqual([0x04, 0x1d]);
expect(record.holder).not.toBe("RALPH");
const strings: Record<number, string> = {};
magikarpHouseSign({ strings, write: () => {} } as never, record);
expect(strings[RAM.stringBuffer1]).toBe("105.3");
// CalcMagikarpLength stores the millimetres (English converts them).
const [high, low] = magikarpLengthBytes(assets.reader, 0x1234, 0x5678);
expect((high << 8) | low).toBe(magikarpLength(assets.reader, 0x1234, 0x5678).mm);
});
});
describe.skipIf(!existsSync(releases[0].rom))("the European releases' Pokédex", () => {
it("reads metric heights and weights and prints them in metres and kilograms", () => {
for (const { rom } of releases) {
if (!existsSync(rom)) continue;
const dex = new CrystalAssets(new Uint8Array(readFileSync(rom))).pokedex;
// PIKACHU: 0.4 m and 6.0 kg; its pages still follow.
const entry = dex.entry(25);
expect([entry.height, entry.weight]).toEqual([4, 60]);
expect(entry.pages[0].length).toBeGreaterThan(10);
const height = dexHeight(dex.dexString("Pokedex_DrawDexEntryScreenBG.Height"), entry.height);
const weight = dexWeight(dex.dexString("Pokedex_DrawDexEntryScreenBG.Weight"), entry.weight);
expect(height).toMatch(/^\S+ +0\.4m$/);
expect(weight).toMatch(/^\S+ +6\.0kg$/);
}
});
});